Hello and Welcome to LinuxQuestions,
You'll have to look into the find command. You wouldn't even need to write a script to just delete directories and there contents if that's what you want to do. Have a look at the man page for starters.
If like you said you have a file that contains a list of the directories, then you'll only need to write a script to loop through the file, check if the directory exists and delete it (and it's contents).
Some good reading about bash scripting:
Bash Guide for Beginners
Advanced Bash Scripting Guide
You'll need to put in the work and when you encounter problems with it, then you come to LQ to ask for help. Don't expect LQ users to give you ready made solutions.