AppleScript: How to add currently-playing Apple Music song to a playlist?
I've been cracking my head on this one as well and currently, there doesn't seem to be any way to add Apple Music tracks to a playlist. It's kinda unintuitive that there isn't a default way in AM to access all loved songs, but here we are. AM is getting better surely but slowely, so fingers crossed.

What I've done as a workaround in the meantime, is added a functionality that saves the song into a text file that is synced to iCloud. That way I can manually enter the songs whenever I have some time to spare and I can do it both on my iMac and Macbook.

tell application "iTunes"
    set loved of current track to true
    set songname to current track's name
    set songartist to current track's artist
    set textpath to "~/Library/Mobile\\ Documents/com~apple~CloudDocs/AppleMusicToDo.txt"

    do shell script "echo " &amp; quoted form of songartist &amp; " - " &amp; quoted form of songname &amp; " &gt;&gt; " &amp; textpath

end tell