You already have what you want.
s = b'<Connection>\n <FileList> \n <File>/home/xyz/xml/text1.xml</File><File>/home/xyz/xml/text2.xml</File></FileList>\n</Connection>\n'
with open("o.xml", "w") as o:
print(s.decode("UTF-8"), file=o)
Now let's look at the output.
$ cat o.xml
<Connection>
<FileList>
<File>/home/xyz/xml/text1.xml</File><File>/home/xyz/xml/text2.xml</File></FileList>
</Connection>