I have an Apple Music Library output file that looks like this:
    <key>6871</key>
    <dict>
        <key>Track ID</key><integer>6871</integer>
        <key>Name</key><string>12 Wake Up Call</string>
        <key>Artist</key><string>Rebelution</string>
        <key>Album Artist</key><string>Rebelution</string>
        <key>Grouping</key><string>AllMusic</string>
        <key>Kind</key><string>Apple Music AAC audio file</string>
        <key>Size</key><integer>6178208</integer>
        <key>Total Time</key><integer>257332</integer>
        <key>Year</key><integer>2009</integer>
        <key>Date Modified</key><date>2011-11-22T23:32:45Z</date>
        <key>Date Added</key><date>2011-12-14T23:30:26Z</date>
        <key>Bit Rate</key><integer>256</integer>
        <key>Sample Rate</key><integer>44100</integer>
        <key>Play Count</key><integer>101</integer>
        <key>Play Date</key><integer>3717804040</integer>
        <key>Play Date UTC</key><date>2021-10-23T07:20:40Z</date>
        <key>Skip Count</key><integer>10</integer>
        <key>Skip Date</key><date>2020-09-16T14:39:31Z</date>
        <key>Rating</key><integer>60</integer>
        <key>Album Rating</key><integer>60</integer>
        <key>Album Rating Computed</key><true/>
        <key>Normalization</key><integer>1699</integer>
        <key>Artwork Count</key><integer>1</integer>
        <key>Persistent ID</key><string>56B43C03AFF476E5</string>
        <key>Track Type</key><string>Remote</string>
        <key>Apple Music</key><true/>
    </dict>
I am trying to make this easier to store in a database (I don't understand SQL, but that's the end goal). For now I am adding and looking up "entries" in an excel sheet. I am able to manipulate the XML file manually by pasting it into a workbook, then I have to use ablebits and vlookups and a bunch of other time consuming operations which I paste into a new text file. End goal of this question is to get my "XML" file to look like this:
<key>5056</key> 
<dict>  
    <TrackID>5056</TrackID>
    <Name>Heart Like a Lion</Name>
    <Artist>Rebelution</Artist>
    <AlbumArtist>Rebelution</AlbumArtist>
    <Composer>Eric Ariel Rachmany, Marley D. Williams, Rourke Carey & Wesley Dallas Finley</Composer>
    <Album>Courage to Grow</Album>
    <Grouping>LIBRARY</Grouping>
    <Genre>Reggae</Genre>z
    <Kind>Apple Music AAC audio file</Kind>
    <Size>11679958</Size>
    <TotalTime>338413</TotalTime>
    <DiscNumber>1</DiscNumber>
    <DiscCount>1</DiscCount>
    <TrackNumber>2</TrackNumber>
    <TrackCount>12</TrackCount>
    <Year>2007</Year>
    <DateModified>2021-11-10T08:29:23Z</DateModified>
    <DateAdded>2021-11-10T08:29:23Z</DateAdded>
    <BitRate>256</BitRate>
    <SampleRate>44100</SampleRate>
    <PlayCount>8</PlayCount>
    <PlayDate>3747937611</PlayDate>
    <PlayDateUTC>2022-10-07T01:46:51Z</PlayDateUTC>
    <ReleaseDate>2007-06-08T12:00:00Z</ReleaseDate>
    <Rating>100</Rating>
    <AlbumRating>60</AlbumRating>
    <AlbumRatingComputed></AlbumRatingComputed>
    <ArtworkCount>1</ArtworkCount>
    <SortAlbum>Courage to Grow</SortAlbum>
    <SortArtist>Rebelution</SortArtist>
    <SortName>Heart Like a Lion</SortName>
    <PersistentID>AD1A6E4E78F9C79D</PersistentID>
    <TrackType>Remote</TrackType>
    <AppleMusic></AppleMusic>
</dict> 
Anything will help, this has become more time consuming and difficult than I thought.
Im also open to alternative routes... I just want to backup my metadata because I lost it once (recovered it manually as mentioned above), but I also have some good ideas for making playlists based on timestamps of metadata values.
Oh side note... Im also open to using another language if that's easier. I have minimal background in code and have been teaching myself AppleScript since my scrips are mostly interacting with Apple stuff.
Thanks!
 
    