Changing the way XML output is done.

Switching from using '>' output to file, to proper python file write.