Automate multiple commands

Hi,
I am trying to count the number of times a string of letters occurs in a file for multiple unique strings of letters. Right now I can do this one at a time using the following code (in this example I am searching for the string "AAA"):

echo AAA >> outfile.txt
grep -c "AAA" -r file_to_search.txt >> outfile.txt

The issue is that I have several thousand of these unique strings of letters to search for and would like to automate things a bit. I have tried adding a #!/bin/bash to the beginning of a file containing multiple search terms but nothing happens when I execute the file. Here is an example:

#!/bin/bash
echo AAA >> outfile.txt
grep -c "AAA" -r file_to_search.txt >> outfile.txt
echo AAB >> outfile.txt
grep -c "AAB" -r file_to_search.txt >> outfile.txt
echo AAC >> outfile.txt
grep -c "AAC" -r file_to_search.txt >> outfile.txt

I am very much a novice and would appreciate any ideas or hints.
Thanks!

Most likely, something does happen when you execute your script. But since nothing is printed on your terminal, you feel as if nothing happens.
Every command in your script is followed by the redirection operator (the ">>") and hence the output of every command is redirected to the file "outfile.txt". So, by the time the script finishes its execution, the "outfile.txt" gets filled up.
You can check that by printing the content of "outfile.txt" after executing your script.

cat outfile.txt

durden_tyler,
Thank you for your response. I have checked and the outfile.txt is not created suggesting nothing is run. I've gone ahead and just cut and pasted my commands into the terminal and got things finished but moving forward I'd like to get this working.
Thanks!

Post some of the file_to_search.txt

The outfile.txt must atleast contain the below three lines since you are appending these strings.

Try debugging the script by adding 'set -x', just after the first line and run it.

Paste here the terminal o/p.