Chosen Solution

If I keep playing with it it will eventually turn on but the minute I turn it off I cannot get it to turn back on

Sounds like your power supplies soft power on logic has a problem. Most likely you need to replace the power supply. Are you up to fixing your own system? If you are review this IFIXIT guide: iMac Intel 27" EMC 2429 Power Supply Replacement