How to print something on the same line?

I need to make a pattern program like this using for loop
AAA and so on
However, both console.log() and print() shift the cursor to a new line.
Is there any method to print on screen without sending the cursor away?