The best (and latest) version for your MacBook Pro is Catalina
But for now, you cannot login because of Yosemite does not support 2 factor authentication. So you will need to get a code from a different apple device. And put this code in the place where you normally should put your password
From your iPhone, iPad, or Apple Watch
If your device is online:
- Go to Settings > [your name].
- Tap Sign-In & Security > Two Factor Authentication.
- Tap Get Verification Code.
If your device is offline:
- Go to Settings > [your name].
- Tap Sign-In & Security.
- A message says "Account Details Unavailable." Tap Get Verification Code.
From (another) Mac
- Go to Apple menu > System Settings, then click your name.
- Click Sign-In & Security > Two-Factor Authentication.
- Click Get a Verification Code.
When you use this code instead of your password, you can login on Yosemite and go to the App Store to update to Catalina.
Hope this works!