Did you already check this user help article?
Syncing to a "New" Computer or replacin…
There is also 3rd party software to copy your music to your new computer.
Music you bought in iTunes can be downloaded again for free, if you are using the same Apple ID on your new device:
If you don’t have a backup of your iTunes library and your old computer is unavailable, you can download past purchases made with your Apple ID through iTunes in the Cloud.
If you have multiple Apple IDs, you might find it easier to transfer purchases from a device after authorizing your new computer with your Apple ID.
If you previously subscribed to iTunes Match, you can turn on iTunes Match once your new computer is authorized.
copied from How to move your iTunes library to a new computer - Apple Support