Researching a bit about file handlers, escape strings and for loops would be useful:
with open("numbers.txt", "wt") as f:
x = 1
for i in range(10):
x += 1
f.write(str(x)+'\n')
CLICK HERE to find out more related problems solutions.