mvhas no destination. Check the arguments.
mv "$file $dir"
mv "$file" "$dir"
ShellCheck found an
mv command with a single parameter. This may be because the source and destination was accidentally merged into a single argument, or because the line was broken in an invalid way.
mv statement by correctly specifying both source and destination.
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.