You are asking about this script? Script: Sort Panoramic-Landscape-Portrait-Square Photos 2019 Version
The scripting changed a lot between Mojave and Catalina, and it is not easy to adapt the old scripts.
I am still using my old scripts, but the photos have to be passed to the script, by selecting the items in a standard top level album or in "All Photos". None of my older scripts will work on the newer system versions, if the items are selected in a smart album or an album inside nested folders. It would need a lot of extra code to allow the selection in nested folders and this will also make the scripts slow. I tested this for this script: Photos 5.0 on Catalina: How to get a list… - Apple Community (snails are faster than this script).
When you are in doubt, if a script is safe to use, don't run it on your main Photos Library until you have tested it on a small test library. And better make a current backup of your your library before trying to run scripts written by others.