Yes, you said yesterday that you ran it in Script Editor and got output in Console.
The screenshot that you posted today only showed the log entries for the On My Mac Junk mailbox, which showed there were zero messages in that mailbox.
But presumably the messages that you want to be filtered are in a server Junk mailbox for one of your accounts. What does the Console log say about that mailbox when you run the script?
If you don’t see that mailbox in the log, it’s most likely because Mail is not configured to use that server mailbox as the special Junk mailbox. You can set it in Mail’s Accounts settings.
That’s not how it works. The messages caught by the server filter are supposed to stay in the Junk mailbox, and the script filters them from there (moving good the Inbox, very spammy to the Trash, and coloring the backgrounds of the ones that are spam).