Is this your problem? I cannot guarantee a solution, but see:
Verification failed : There was an error connecting to apple id server https://discussions.apple.com/thread/7238348
How To Fix Verification Failed Error Prompt After Update To iOS 13 Verification Failed. There was an error in connecting to your Apple ID
6 Fast Solutions to Fix Error Connecting to Apple ID Server [NEW]https://www.fonedog.com/ios-data-recovery/an-error-connecting-to-the-apple-id-server.html
Verification Failed: There Was an Error Connecting to the Apple ID Server, Fix
https://macreports.com/verification-failed-there-was-an-error-connecting-to-the-apple-id-server-fix/
You may also want to contact Apple Support for help with your problem. See:
Get a call from Apple support to help solve your problem using this
link https://getsupport.apple.com/?caller=kbase&PGF=PGF63005&category_id=SC0245&symptom_id=23362
Apple ID Support https://support.apple.com/apple-id
Apple ID account security for country-specific and
region-specific help https://support.apple.com/en-us/HT204169
Get Support: We’re here to help https://getsupport.apple.com/. Go through the options to find the best support option.