How to save iTunes playlists and songs to XML?

1. Open iTunes
2. Make sure you have Apple Music enabled and are logged in correctly to your account.
3. Go to File > Library > Export Library and then save it to xml file.

itunes to xml

iTunes will take a few moments to save the songs and a new xml file with your songs will be created.