Thanks for the reply, Robyn.
There is actually a method for transferring music from your iPod to a new library BUT as you have found out it's also much too easy to accidentally erase the iPod during first sync as that is the default option.
I hate to be the bearer of bad news and please don't shoot the messenger but any music you have ripped from CD yourself will have to be re-ripped as it is now lost and there is no backup on the iPod of music.
Purchased music can be downloaded again at no additional charge, however.
First, open iTunes
Click the "Store" option in the menubar and choose "Authorize this Computer..." and supply the Apple ID and password XXXXX used to purchase/download the lost music.
*Note: If running iTunes 11 on Windows, you may need to show the menubar
Next, select the iTunes Store. Sign in with the same Apple ID and Password, if you are not already.
In the iTunes Store, you should see a Quick Links sidebar at the right side of the page. Look for the "Purchased" option and click it.
On the Purchased page, you will see a toggle near the top-right of the page labeled as "All | Not In My Library". Select "Not In My Library".
Under Music, select "All Songs" from the listing at the left and then click "Download All" in the bottom right.
If you continue to have questions on this topic, just reply back to this discussion. I will be more than happy to work with you further. Hopefully, this info will answer your question. If so please, please remember that when you are asked to give a rating, you are rating my personal service only and not this website itself or your issue.
Thanks and good luck,