This is one possible way.
Originally Posted by mrproper
More generally, the machine may have to remember (in its state) character(s) it read during previous step(s). I.e., there have to be several copies of one state, one per character read during one of the previous steps.
Here is a possible execution trace. There is a loop during which the machine reads two characters and writes four characters; then it starts the next iteration of the loop.
I write step numbers in parentheses. What follows is the description of the machine before the corresponding step. The top line shows the input tape and the bottom line shows the work tape. I write "|" before the character that is observed by the head. Since "|" is not an actual character on the tape, ignore the spaces between characters; they are for alignment only.
(1) |ABC (2) A|BC (3) |ABC (4) A|BC (5) AB|C
| A| AA| A AB| AA BB|
During step 1 the machine reads A and writes A on the work tape. It also remembers A in a state. Both heads move right. During step 2 the machine writes the character it remembered ("A") and not the one observed on the input tape. It also remembers the character it observes ("B"). The input head moves left and the work head moves right. During steps (3) and (4) the machine writes the latest remembered character ("B"); both heads move right.