Add template to end of file when tag added

What I’m trying to do

When I tag a file as abbreviation, it gets moved automatically to a folder with Auto Note Mover. I also usually hit Ctrl+L to run Linter and sort the tags and properties out as well.

When I tag the file, I want a template to be added to the end of the file. It’s just a simple dataview code block that is relevant to files with that tag.

I guess the steps would be:

  1. Add tag to file
  2. File saves
  3. On file save, check tags. If tags include abbreviation then add template to end of file.

Things I have tried

I’ve searched in the forums, found lots of stuff about Templater, but I can’t see a way to add a template based on conditions when the file changes.