@Rok73 Thanks to some
outside help 
the script is fixed and can be saved as as app.
I’ll explain step by step
- Open Script Editor (/Applications/Utilities/Script Editor.app )
- Copy-paste the code below, with your password instead of 1234
Code:
set ScreenLockStatus to do shell script "sysadminctl -screenLock status 2>&1 | awk -F'] ' '{print $2}'"
set question to display dialog "The screen lock is set to: " & ScreenLockStatus & return & "Would you like to:" buttons {"Set to immediate", "Set to 5 minutes", "Cancel"} default button 1
set answer to button returned of question
if answer is equal to "Set to immediate" then
do shell script "/usr/sbin/sysadminctl -screenLock immediate -password 1234"
end if
if answer is equal to "Set to 5 minutes" then
do shell script "/usr/sbin/sysadminctl -screenLock 300 -password 1234"
end if
if answer is equal to "Cancel" then
return
end if
- from Script Editor - File - Export – choose a name and the location where to save the app, File Format – Application, Run-only, Don’t sign code.
Now you can run the app and you will see these options.
The script can be modified with different values for seconds or off instead of immediate, if you want to turn it off.
Apple Save a script as an app in Script Editor on Mac
https://support.apple.com/guide/script-editor/save-a-script-as-an-app-scpedt1072/mac