Okay, so I should probably run this on my calculator to see if this works, but here is how I would think you would do this. I am using 1 as the head and 0 as the body, and have marked new and changed lines.
Output(B,A,"1 //changed (outputs head at new position)
Output(H,G,"0 //changed (outputs segment on top of old head)
I just tried that code on my calculator after removing the quotes and replacing the squares with →. It keeps giving me a syntax error...