When 2-factor authentication (2FA) is enabled in WHM or cPanel, it prevents login until a code is verified from an external device. Sometimes that device can be lost, damaged, or reconfigured, which disrupts the external validation process. Here are the steps you can take to disable 2FA from the command line via SSH.
Make sure you login as the root user on your server and run the following command:
whmapi1 twofactorauth_disable_policy
This will disable 2FA for your WHM, and will allow you to log in to the server and perform an update to the 2FA policy for your new device.