Well, as I already said look at the functions for int 21h. One of them checks to see if anything is available in the keyboard buffer and another will get it. So first you have to declare a buffer to store the string then call those two functions to fill it up wih the keystrokes.
Here could you find some tasm-like code what I posted related to similar problem, especially the inbuffer definition, the int 21h function 0AH and offset fit real mode tasm/masm well. Keep in mind, that code not tested.