Lost all computer files, now I need to transfer my music on my iPhone to my iTunes?

I have a MacBookPro I got in 2010 and I just recently had an incident with it where all the files had to be deleted. I now have none of my music. I have Carbonite backup, but for some reason, it won't download my music. I have all the music I want on my iPhone still. Is there any way I can transfer that from my iPhone to my iTunes/computer? I don't have all the CDs still, some of them I just borrowed from friends, so I can't just re-download all of my music. I have tried SharePod, but it wouldn't work. I appreciate any and all answers.

Connect iPhone to computer, then drag all the music files from your iPhones music library to the iTunes music library

To help you manage the music transference from iPhone to computer, you need a third-party app named iTransfer. It is a tool exclusively designed to make data transference between iOS devices and computer happen. What you get to do is just to plug in the iPhone, choose those files you want, specify the location of the output file and then click Transfer Now button to manage the transference process. Moreover, iTransfer only works when you have installed iTunes beforehand.

TouchCopy for Mac is another good program that you may work better for you
http://www.wideanglesoftware.com/touchcopy