Also, instead of nesting the If Then Actions you can put them one after the other. This can be good for testing for more possibilities than just two i.e. A, B, C instead of A, B.
Your logic is (sort of) right, it's the event sequence that is the problem. As @Zabobon says, if you only want to react to A or B you can pause until either are pressed:
But it really does depend on what you are trying to do. For example, this one will react to any, or no, key being down when you release the trigger key:
Also, this is probably pointing out the obvious but in a real-use case simply waiting for a key to be pressed without some kind of user prompt would not be very useful.
It is more likely that at some point in the Macro you will ask the user if they want to branch to A or B (or C or whatever). In which case you can branch the Macro depending on their response including canceling the Macro if that is the choice. The below will work whether you click the buttons or just type A or B.
The Prompt replaces the pause, as the Macro won't carry on until you respond.
And calling the buttons A/A B/B etc means they can either be clicked or the key indicated after / can be typed. The /. after Cancel means that hitting Escape will activate that choice.