> It costs a lot to buy those music files and that too if they are available (which isn’t always the case)
Virtually all music, particularly modern music, is made available for free on YouTube. You can download it and it's yours.
For example, here's the official release of Taylor Swift's album "Evermore" for YouTube ("Provided to YouTube by Universal Music Group"): https://www.youtube.com/watch?v=qxrMpCMdYwk&list=OLAK5uy_m-v... . You should be able to pass the playlist to yt-dlp and automatically extract all the audio tracks.
I don't really want wholesale quantities of music, so I do this manually, but I wouldn't be surprised if there's tooling around for it.