I'm not sure I completely understand what you are asking. Are you asking how you can play music from another source inputed INTO the iMac or music from the iMac input "Out-to" another system.
I'm not sure what iMac you have, but my guess is that your iMac does not have a line-in plug so you will have to purchase an external adapter. I use the Griffin iMic (about $30) with my flat-panel iMac and absolutely love it.