But that’s a complete rule, suitable for putting in an xxx.rules file without any UI involvement at all.
If you use the UI, then you must use the UI to define the rule trigger.
The only bit of the shown rule suitable to be included is the stuff between ‘then’ and ‘end’ exclusive, to be put in the script section and be marked as type DSL.
EDIT - depending on the OH3 version in use, this might still be relevant -