You have this all backward. The primary repository and source for music in iCloud and on your phone is your computer. You transfer it from your old computer directly to the new one. Do not rely upon your phone or iCloud as being an archive or backup for media.
Moving a library: Quick answer if you use iTunes' default preferences settings: Copy the entire iTunes folder (and in doing so all its sub-folders and files) intact to the other drive. Hold down the option (alt) key (shift on Windows) and open iTunes. At the prompt to create or choose a library choose the iTunes Library.itl file in the copied iTunes folder.
When this is to a new computer put the copied iTunes folder in the default location of Macintosh HD > Users > *User Name* > Music then you don't even need to start with the option key held down, iTunes will automatically look for it there. (Make sure there isn't anything already in the iTunes folder there that you want to keep since you will be replacing it with the one you are moving.) Also remember to authorize the computer in iTunes to your Apple ID if you use this to sync to Apple mobile devices.