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 will take a few moments to save the songs and a new xml file with your songs will be created.