In general you would want to backup the entire ~/Music folder to an external drive, where ~ is your user's home folder, then copy that back to your internal drive after you have wiped and reinstalled the operating system. It may be better however to backup the entire user folder to ensure you also capture all of your documents, pictures, movies etc. as well as your music. If you capture everything you can always be selective about what you restore later. As Joni Mitchell told us, you don't know what you've got 'til its gone. I'd recommend setting up Time Machine if you haven't already as that can capture all of the significant data on your machine automatically, complete with some version history in case you realise belatedly that you've made a change to some file or document that matters.
tt2