How do sync my my iPhone with iTunes?

I reinstalled my PC and all of my data gone, but I've got every music on my iPhone. How do I sync it with iTunes without loosing anything from my iPhone? It's only allows me sync the whole lybrary, but then I'm going to loose everything from my iPhone and I don't want that.

Its hard