Applaud your efforts but let me encourage you to skip the shell scripting and go straight for perl or python. It's a lot easier, more fun, and you'll make more money probably. I know lots of sysadmins who are "still" trying to learn "shell scripting", whatever that is. The rest of us have moved on.
So building on what spirit receiver said, have a look at the output from: find2perl /hltv/dod -type f -name "*.dem" and then delve into the ever present and extremely useful File::Find module. You will have something robust built in no time.