If you are having issues transferring purchases as outlined in HT1848, you may want to try redownloading the music in question directly to iTunes on your iMac. You may find the following article helpful:
You can't transfer songs from your iPhone to your computer, unless they are purchased from iTunes Store. If they are iTunes Purchased songs, connect your iPhone with your computer via a USB cable > Press the Alt and F keys > under Devices, choose Transfer Purchases. For those non iTunes purchased songs, you need a third-party tools to export all songs from your iPhone to your computer. If you don't know any such kind of tool, try iOS Manager. I've owned one, it works pretty well. This is the tutorial: how to transfer songs from iPhone to Mac.