How to transfer non purchased songs from iPhone to mac?

The apple store had to restore my mac laptop so now it's like a brand new computer. I have non purchased songs on my iPhone that i would like to be in my iTunes library but when I select "Transfer my purchases from my iPhone" it literally only transfers the songs I have purchased. I've tried multiple music exporter programs but they all need you to pay money. Is there an easy way I can transfer these songs easily and for free?

Plug up your phone, then drag each song into the library of iTunes