If I have several Safari tabs open in a single window, I want to move one tab to a new window, then half the two windows (one on left, one on right). The window is on my second monitor, but the attached macro moves the windows to my main monitor. How can I get the macro to keep the windows on my second monitor?
Well, if the "Move Tab to New Window" is placing the new window on the primary display, even when your Safari window is on the second display, then that's probably a bug in the Apple Safari Menu item. Of course, with KM we can usually find solutions.
Which OS do you have? If you have Sequoia, there may be a simpler approach that your attempt above.
In either case you still have to move the window from one screen to another. I think you will find the answer to that problem in the following thread. In that example, it's possible that you may get better results if you change "Back" to "Second."
I'm not sure if this advice is a complete solution to your problem, but think of it like turning you in a better direction.
Because you are explicitly calling SCREENVISIBLE(Main,... in your "Move and Resize" actions.
If you take a look at the function's Wiki page you'll see the various ways of referring to different displays -- which you choose will depend on your setup. Second sounds like a good choice, from what you've described.