Logfile recreation

hi,
In my experiment subjects need to remember words and in the test phase to write them down using the keyboard. they write every word in the relevant textbox. there are 6 textboxes and in order to decide which textbox they want to begin with or to forward to they need to press 1-6 on the keyboard.
the logfile contains something like this:
DATA 1
DATA c
DATA a
DATA t
DATA 2

Is there a way to create another logfile that takes the data from the original logfile and connect the syllables to a word?
such as:
DATA 1
DATA cat
DATA 2