The easiest way for this kind of effects is to use the caret return \r
character that lets you write over the previous line.
If you'd like to have direct access to the console's buffer (i.e. writing in specific X/Y position instead of line-by-line), then you're probably looking for a helper library like pdcurses
.