By reading the exercise order, I see you were close to the answer and assumed this is what you wanted.
user = int(input("How many numbers you want to enter?
"))
file = open("file1.txt", "w")
for x in range(user):
number = input("Enter number " + str(x + 1) + ":
")
file.writelines(str(x) + "
")
file.close()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…