Firewire (IEEE1394) was, in the G3 to early Intel Mac era, commonly used as a high speed communication link, very frequently to external hard drives. 'Target Disc Mode' is a way of starting up a Mac in a way which makes it behave as nothing more that a Firewire external hard drive. How old is you iMac? And can you identify a port labelled with a little circle and three little marks equally-spaced round the circle?
If so, all you need is a Firewire cable, which many long-standing Mac users will have in a drawer of useful things. You can borrow the keyboard from your iMac while starting the G4 (just press T while starting, holding it for perhaps a minute if there is no monitor, or until a yellow Firewire symbol appears and jumps about on the screen). Go back to the iMac, taking the keyboard with you, start it up, and look on its screen for a new icon (in yellow, I think). Open it and look for and drag out your files.