I notice that this is a study drill from the book "Learn Python The Hard Way". Though you've asked this question 3 years ago, I'm posting this for new users to say that don't ask in stackoverflow directly. At least read the documentation before asking.
And as far as the question is concerned, using writelines
is the easiest way.
Use it like this:
target.writelines([line1, line2, line3])
And as alkid said, you messed with the brackets, just follow what he said.