Assuming you'd like to append the contents of the file template to the file data only if no line from template already exists in data.
The command for testing whether a line in template is found in data is
grep -xF -f template data
(This is a reasonable thing to do only if template contains less than a few thousands of lines)
This uses the following options of grep:
-x, forcing testing complete lines, from start to finish of the line. Without this, we may get false positives if a line in template matches a line in data partially (for example, the line hello world matches hello world! partially).
-F, using string comparisons rather than regular expression matching. Without this option, grep would treat the lines in template as regular expressions, which may produce the wrong results if any pattern line contains characters that are special in regular expressions.
-f template, this makes grep use each line from template individually as patterns to match against each line in the data file.
Adding the -q option to this (to make grep quiet and to let it exit as soon as a match is found) allows us to use it in a simple test:
if ! grep -q -xF -f template data; then
cat template >>data
fi
The if statement body appends the template file to the end of the data file only if the grep command fails to find a match of any lines from template in data.