Have you searched the Mac Help (Finder --> Help menu)?
It should detail what cable you need.
At any rate, you need a 1/8" stereo minijack to RCA connector cable that goes from the headphone out on the back of your iMac to an Aux or tape input on the stereo - provided the hifi has an extra, unused input.
If you want surround sound, there are a number of different products available that connect to either the Firewire or USB ports of your iMac.
Search this forum and the Peripherals forum for details, as the surround question has been discussed numerous times.
If there has been no specific device mentioned that will allow you to connect both the iMac and the TV/DVD system at the same time (not sure why you'd want to, unless you wish to listen to surround sound on both systems), I'd suggest starting a new thread with that specifically mentioned in the title.