One relatively easier way would be:
import os
prompt = ''
while True:
    number = input(prompt)
    os.system('cls')
    # prompt += number + ' ' #If you want the control input to be printed, keep this, remove the other
    if int(number) == 13:
        print(prompt)
        print('goodbye')
        break
    prompt += number + ' '    # add this line before the if starts, if you want to keep 13
    os.system('cls')
Output:
1 2 3 4
goodbye
Notice, this does not print 13 as you wanted in the comments. However, if you want to keep it, you can move it to the line before the if condition starts.
This works in Windows command prompt, cannot guarantee about different IDLEs/iPython etc.
NOTE:
This clears all lines in the console, and rewrites them. This works for your particular problem, but may not be ideal if something else has also been printed before. If you want to avoid that, you will have to redirect sys.stdout to a file or some kind of string buffer before you hit this part of code, then reinstate stdout and store the content of the buffer as text in the prompt variable used above.