This is a very simple problem that you should be able to solve on your own.
Since you're having some trouble, I'll show you how to, generally, attack most programming problems.
First, divide the problem.
You have a text file which you must modify to include xml tags. You've correctly identified that opening and writing to files are separate problems - and you already know how to solve those. Futhermore, it's obvious but worth mentioning that you're dealing with a similar repeating pattern on each line. So, if you know how to transform each line of the text into what you want, you'll have solved the problem. Now, let's look at that first line:
Hello
becomes
<tag1>Hello</tag1>
What steps must be performed in order to transform one into the other? Well, the second is just the first with some text inserted at the beggining and end of the string! This is called string concatenation, and simply googling will find you an answer immediately.
Further, you have the issue of the tag number, which is different on each line. This is solved by keeping a counter variable, converting the number to a string, and concatenating it too.
Here's an example of a counter:
for i in range(10):
print i
and another:
i=0
while i<10:
print i
i+=1
That's it. I'm confident that you can solve the problem on your own now.