A 1/4" plug will not fit the iMac. As you have noticed, the iMac does not have a line input.
You will, indeed, need an external sound card. I have found that the Behringer UCA-202 works well.
This thread https://forum.audacityteam.org/t/sound-card-reviews/8375/1 reviews other options.
– Bill