The very first thing to do is start and maintain a backup of all your music that you currently have access to.
This should be on an external drive, so that if your computer is lost, or badly broken, the backup can be used on a different machine. Devices such iPods, iPhones etc. are not backup devices. Do not rely on them.
Next, start recovery of any of the music that you do not currently have in your iTunes library or that is only on the iPod. Note, music on an iPod is not a backup and it is not an easy or cost free exercise to recover it from an iPod.
So:
- re-copy from your CDs (both music CDs and data CDs with music on them)
- re-download music that you purchased in digital format from your account with online sources such as:
- the iTunes Store
- Amazon
- Bandcamp
- Beatport
- etc. etc.
For any music on your iPod that you can no longer recover from elsewhere (as above), either buy replacement copies (if the tracks are still available for purchase) or use third-party software to recover the music from the iPod. The following tip from user tt2 offers help with this: Recover your iTunes library from your iPo… - Apple Community.
Some of tt2's suggestions offer limited free recovery. Perhaps once you exhaust all of the above options, you may be lucky and be able to use free software to recover the outstanding tracks.