I've tested the code below (from another question) and indeed it works fine, but I have minor problem with it. As my two SSIDs are called "kat" and "kat2", the expression "starts with" won't work for me. I tried to replace it with "equals" or "ends with" but for these two options I get the result "missing value".
Any thoughts?
From URL: Big Sur 11.1: AppleScript to Automatically Change Wi-Fi Networks
tell application "System Events" to click every menu bar item of menu bar 1 of application process "ControlCenter" whose title starts with "Wi‑Fi"
tell application "System Events" to click every UI element of scroll area of group 1 of window "Control Center" of application process "ControlCenter" whose title starts with "YOUR_SSID_HERE"
whose title is equal to "YOUR_SSID_HERE"
works for me in macOS Catalina, but cannot test in macOS Big Sur at this time.