in reply to output on top of old output

It probably positions the cursor using something like Curses or on of the Term::* modules if you are on a Unix-like system.

/J\