Insert text where blinking "|" is

I seached every where but couldnt find it. I’m guessing its javascript, but i have no idea how to do it.

When a button is pressed it should add text after the blinking thing.(i dont know what its called).

thanks.