Hello! 
What you want to accomplish, is to paste text into the program, when it is active?
This works for me, when I insert text into an editor inside the terminal, like pico or vim, but I am just typing it, using regular text, ( and the text is typed like if I had typed it in, via the keyboard.
The applescript, is stored and executed from the the script menu in my user folder, so I have access to it from various applications.
tell application "Terminal" to activate
tell application "System Events"
set my_string to "This is my typist"
keystroke my_string
end tell
Should you wish to send keycodes, for for instance sending special keys, then you will have to download a program like keycodes that shows you the actual commands.
This little example, shows how I would execute several commands, you can have a string that contains return/linefeed by inserting them promptly, or by massaging your text a little.
This is just a hack, illustrating how I would have sendt a key to your dosbox, assuming the dos prompt is there:
tell application "DosBox" to activate
tell application "System Events"
keystroke "C:"
delay 0.1
keycode 36 ” Sending a return to finish off what is typed
keystroke "dir"
delay 0.1
keycode 36
end tell
Rereading your post: I think you want something like this:
it is up to you to try it and test it 
set {oldtids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, linefeed}
set theDosText to every text item of theDosText
set AppleScript's text item delimiters to {return}
set theDosText to theDosText
set AppleScript's text item delimiters to oldtids
tell application "DosBox" to activate
tell application "System Events"
keystroke theDosText
end tell
I hope this helps, do come back if it doesn’t work for you.