Mac cannot connect to iCloud
I have been using my MacBook Air (current version is macOs High Sierra 10.13.6) for over 3 years, but never faced such an irritating issue before.
A window keeps popping up which says "This Mac can't connect to iCloud because of a problem with <apple id>. Open iCloud preference to fix this problem". I open iCloud preference and enter the password to proceed and this message appears "An unknown error occurred" and the there is no end to the loop starting from the beginning! In the process, my mail boxes and iCloud drive files have disappeared.
I have gone through at least 30 discussions in various forums about the exact issue as mine. I have tried almost all the solutions suggested except probably formatting the Mac. I have tried the following:
1. Changed password
2. Signing out of iCloud on this mac does not happen as the same error shows after entering the password
3. Restarting and shutting down the Mac several times
Requesting for help please!
MacBook Air (13-inch Mid 2013), macOS High Sierra (10.13.6)