The bash for-loop construction expects one or more objects from the command-line, or in this automator example, the folder passed into the Run Shell Script via the as arguments setting. The $@ variable is a list of those passed in objects, and in this case, just the folder path. Each pass of the for-loop updates the variable f with an object from the "$@" list.
The mdfind(1) application works off of the Spotlight database, and has no syntax commonality with the BSD find(1) command other than having recursive behavior when working on a folder path. Let's say the full path of the folder passed to the Run Shell Script is:
/Users/yourname/Desktop/Dest
That becomes the f variable in the for-loop as it is the only item in "$@".
Then, the mdfind command would perform the following:
mdfind -onlyin "/Users/yourname/Desktop/Dest" -name \( 'kMDItemKind == "Folder" && kMDItemUserTags == "*"' \)
Any folder found in the above path that had any tag on it would be found by the Run Shell Script. I use the -onlyin argument to restrict where mdfind searches. If you removed it, and supplied /Users/yourname as the f variable path argument, then mdfind would search your entire home directory including its Library hierarchy. That would get out of control.
That wildcard used with kMDItemUserTags is asking for match any tagged folder regardless of the color. If you wanted to return all folder's with a green tag. The lowercase 'c' following the tag name means case-insensitive to match Green or green. Shouldn't need it, but there for failsafe.
mdfind -onlyin "$f" -name \( 'kMDItemKind == "Folder" && kMDItemUserTags == "Green"c' \)