Music deleted from my iPhone 4
If you bought it on the same Apple ID, then the iTunes on your computer should see that you purchased those songs already. Therefore, you should be able to simply sync music back to iPhone.
Perhaps I'm not understanding your question though. So I'll cover both sides.
Transferring Music from iPhone to Computer
If you purchased songs and you bought them on the same Apple ID, you can simply transfer purchases back onto your iPhone. See the picture below.
Just go to File =&gt; Devices =&gt; Transfer Purchases

Transferring Music from Computer to iPhone
First of all, you can see what content you purchased (make sure you sign in to the iTunes store first). Take a look at the picture below. You should see it under the Quick Links section:

However, to automatically transfer these purchases from the computer to the iPhone, you need to follow these instructions:
On the iPhone Side:
You need to use Automatic Downloads. Make sure it's on by following the directions in the picture below.

On the Computer Side:
Make sure that iTunes has the preference that is mentioned in this picture enabled.