You could compact your code into 3 lines as well by doing what follows:
f = open('out.txt' , 'w')
f.write("line 1 \n line 2 \n line 3") #And so on
Also, if you want to add variables to the text file instead of static text by doing this:
name = input("What's your 1st name? ")
nametwo = input("What's your 2nd name? ")
f = open('out.txt' , 'a') #You must use 'a' so it won't remove previous things you have logged in the file.
f.write(name + '\n' + nametwo)