You're suffering from buffering. If you want to do something like this, but not depend on ANSI terminal control codes, you might try to use just
"\r" characters on its own line. See my
peek - output a one-line preview of stdin writeup for more.
--
[ e d @ h a l l e y . c c ]