If you have Two-Factor Authentication for your Apple ID, and a device with older software, then the procedure is a bit special:
What if I use two-factor authentication on a device running older software?
If you use two-factor authentication with devices running older OS versions—like an Apple TV (2nd or 3rd generation)—you might be asked to add your six-digit verification code to the end of your password when signing in. Get your verification code* from a trusted device running iOS 9 and later or OS X El Capitan and later, or have it sent to your trusted phone number. Then type your password followed by the six-digit verification code directly into the password field.
There is a time limit before the code expires, so request your code (or a new code*) after entering the characters of your password, to use those precious seconds effectively for just the code.
If you tried the above as described and it didn’t work, then try this suggestion:
Apple TV stuck in login loop - Apple Support Communities