I'm assuming by output that you mean the 'sever = lines' string that we discussed before but you can do this in one of three ways. Open a file in write or append (in this example this is called output) and replace the print like with.
1) print >> output, '%2s = %10s' % (line.strip(), total)
2) output.write('%2s = %10s' % (line.strip(), total))
Or assuming you want to overwrite existing data you can use this form from the command line.
3) python program.py > output.txt
Is this what you wanted,