Create an automator script to create folder + move files into created folder

Solution 1:

Here is an alternate solution.

Not sure if you're aware of this but there's already a keyboard shortcut in Finder, (control + command + N) which creates a new folder containing the selected finder items. This can also be accessed through the contextual menu when right clicking on selected Finder items.

This AppleScript code works for me using the latest version of macOS Mojave.

enter image description here