Perhaps if I explain what happened and why.
- You can only Sync your phone (or any iDevice) with one iTunes Library at a time
- reinstalling iTunes means that it's a new installation, so it has never Synced with that phone before. The two devices (iTunes and the phone) will not "recognise" each other, so iTunes will see the media on your phone as belonging to a different iTunes Library
- from the two points above, if you attempt to Sync a phone (or iPod, iPad etc) to a different iTunes Library, iTunes will ask you if you wish to delete the media (music) from the phone so that it can add music from its own Library. That's how it works
- iTunes cannot move music from your phone to iTunes. You would need a third-party application in order to do that - and it's not a simple process. Nor is it free, except for your first few songs
Here are some golden rules:
- Back up all your music to an external drive. Do not rely on iTunes as the only place your music is located. (In fact, it's located on your computer, all iTunes does it catalogue it.) Computer hard drives fail
- Maintain that backup
- Do not use your phone as a backup. It isn't!
- If you have no backup and you need to recover music that you've lost, how you do that depends on where you got the music to begin with:
- music purchased from the iTunes Store - sign into your iTunes Store account and re-download from the store*
- music purchased as mp3s from Amazon, Bandcamp etc, - go to your account with that store and re-download from that store*
- music imported into iTunes from CDs, - re-import from that same CD
- music from other sources - go back to that source
- music that irreplaceable (i.e. personal recordings etc.) - that's why you need a backup
* It has been known for music to be removed from a store, usually due to the owner of the music having it removed, so the best option is to backup purchases as well.
Did I mention making your own backup? I believe I did.