If your MacBook is running indeed OSX 10.10 Yosemite, you cannot login to the App Store when you have two factor authentication enabled with your Apple ID and password. Instead, you will need to put a verification code in your password field.
As you cannot get to the normal 2 factor authentication screen you will need to generate a verification code on another apple device in order to log in. See this instructions on how to do that:
If you can’t receive a verification code on your trusted devices automatically, you can get one from Settings, even if your device is offline.
From your iPhone, iPad, or iPod touch
If your device is online:
- Go to Settings > [your name].
- Tap Password & Security > Get Verification Code.
If your device is offline:
- Go to Settings > [your name].
- Tap Password & Security.
- A message says "Account Details Unavailable." Tap Get Verification Code.
From your Mac
- Go to Apple menu > System Preferences, then click Apple ID.
- Click Password & Security > Get Verification Code.
Put the code you received instead of your Apple ID password, and you can login to the App Store now