You need to remove the previous value before printing the new one. There are several ways to do this
- clear the screen - this causes flicker. Don't do it
- print spaces in the background colour where the old value is - better
- print the old value in the background colour - best
Whatever method you use, only write to the screen when a value changes