How to move all files to subdirectories by extension name in the specified DIR directory?

If I'm understanding your question correctly, globbing should help you. If you're going to be using linux for a while, I'd recommend reading up on it, as it makes using linux and bash much easier.

To directly answer your question, something like this should work:

mv *.<extension> <target directory>