The UNTIL command requires a REPEAT command with it. Put REPEAT before the code you want repeated, and UNTIL after the code to be repeated. UNTIL requires a condition as well - this can be any normal expression you may use with IF, for example. This will tell it when the loop should stop - UNTIL A==1 for example will keep looping until A is equal to 1.
Your locate statements are kind of all over the place. If you could comment them out or replace them with PRINT : PRINT like in my last screenshot that would help debugging. My guess however is you aren't checking for A or B right and it is running both. Can you post your code again so I can check?
the locate statements are kinda meant to be in two location the question up top answer in the middle-ish and also i'm running into a problem to where it cuts off a part of a answer from another question and paste them somewhere else which is interesting