All "GOTO @FIRST" except the last one (line 49) should follow just after IF statement as follows.
IF BUTTON()==2 AND D==5 THEN D=12:LOCATE 15,5:?"| | ":GOTO @FIRST
And I guess "END"s in your attached photo are not necessary.
BTW, is there "VSYNC 1" in @FIRST loop? If no, please insert it.
1そうだね 未プレイ