Please take the computer to your local Apple Authorized Service Provider to be professionally diagnosed and then you can decide on a course of action. If you take it to an Apple Store they do not charge for diagnostics and if it requires repair they will quote the amount so you can decide.
Kernel Panics are extremely difficult to diagnose because they can be caused by software or hardware and in rare cases both. Hardware includes external peripherals too, if one has failed or is woefully out of date that can cause a KP. The same thing with software, if you have third party software installed and have not updated it regularly then this can be a cause of KPs.
On the computer, RAM is a frequent cause of KPs. If you ever updated the RAM and installed ANY but Crucial.com or OWC (www.macsales.com) RAM then that is a great place to start. iMacs are extremely sensitive to RAM and demand using very high quality RAM, both Crucial.com and OWC meet those needs. Note, if you installed Crucial RAM and did not buy it directly from Crucial that could be an issue.
Also, if you installed any of the following types of third party apps those are MAJOR trouble makers:
- Antivirus
- Security
- Cleaning
- VPN
- Maintenance