I would stay away from trying to manipulate the file directly - I am even not sure if this is working. It is much simpler to read in the file and then overwrite the new file - as long as your input file will never exceed your memory:
with open('file.txt') as fin:
# get lines of the file as list
lines = fin.readlines()
# Overwrite file.txt with new content
with open('file.txt','w') as fout:
fout.write('Python\n')
for line in lines:
fout.write('Test: ' + line.strip() + ' -t\n')
If memory is of concern and you don't mind to get a new file:
with open('file.txt') as fin:
fout = open('newfile.txt','w')
fout.write('Python\n')
for line in fin:
fout.write('Test: ' + line.strip() + ' -t\n')
fout.close()