Is there any way to append text based on the current position of the cursor

Is there any way to append text based on the current position of the cursor?

for example i would like to let user press a button to insert some text at the current position of the cursor

thanks