Your problem(s) are in this line:
if `cat $htmlFile | grep -inE "\<br\>"` ; then
It's telling the shell to:
- cat a file,
- parse it and look for lines that match the
<br>tag, - execute the output
The problem is the last step, you shouldn't execute the output of the command but test it:
if [ grep -inEq "\<br\>" $htmlFile ] ; then
Of course, to parse HTML you should use a real parser, no regexes.