First, be an optimist that it just requires an update. Go to Settings/General/About and look at Modem Firmware. Is the entry blank? If it is you need to reinstall it by restoring the phone to factory settings, then restoring a backup. Back up the phone first, of course:
- How to back up your iPhone, iPad, and iPod touch - Apple Support
- Restore your iPhone, iPad, or iPod to factory settings - Apple Support
- Restore your iPhone, iPad, or iPod touch from a backup - Apple Support
If the modem firmware DOES have a value you may have a hardware problem. So see if this Apple recall is still valid for your phone→iPhone 7 Repair Program for "No Service" Issues - Apple Support
Then you need to contact Apple support using the Get Support link at the top of this page, whether it applies or not. But if it doesn’t it may not be worth the investment to repair a 5 year old model.