Thanks Jarry this also did not solve the problem actually I wanted to insert text at any cursor location instead of inserting text on a new line.
However, after some search on google I found the solution to my problem.
Following is the example for those who wanted this functionality.
http://code.reloado.com/ubucoj3/7/edit#preview