How to clear a text before a new text is placed in some spot

Just realised spaces will not work, if the old characters are showing through, then a space will not cover anything. Only other option is to keep track of whatever was previously printed and reprint that in the background color.