Oh, boy, props for getting this working, but this looks really distracting to actually use as a prompt for my tastes.
Edit: If I understand what you're doing, then maybe you can use this:
tput ind; tput home; tput il1; echo -n "header"; tput el; tput cup $LINES 0
Use "man terminfo" to lookup things like "il1" and use "infocmp" to see what they translate to in your terminal.However, for your problem, have you considered the terminal's title instead of the top line of the tty? printf '\033]0;foo\007'