and this Non-B that expires in June 2023 you got where? From a thai consulate in your country before you came here OR from the immigration office inside thailand?
I ask because I really think IF you look at your stamp you're on what's called an "Extension Of Stay" and the stamp says "extension of stay permitted until with the June 2023 date on it
If that's the case you can GO to the immigration office where you got that stamp before the date of your flight and buy a re-entry permit OR you can get one at the airport on the day you fly out, after you check in.
The international airports all have re-entry permit counters that run
****
(and if no one is at it they'll get someone for you)