Of course that's possible. Shell commands can be executed from the console or using a shell script. Of course when using a shell script you need to take care of error handling, for example, first check if a directory you create doesn't already exist.
mkdir -p /directory1/directory2/directory3
will create the tree structure the same way if executed from console or from a script.