The general schema for a Trigger-based Template entity with actions like yours is:
template:
- trigger:
# List of triggers
action:
# List of actions
sensor: #This is what you are missing
# List of sensors configurations that are linked to the trigger and action above
What you have posted does not have a template entity domain like sensor, switch, light, etc… it is effectively just an automation outside of the automation integration.
It may be that you meant to include a template entity but forgot it, or you accidentally added a dash as follows, creating a template entity unrelated to the trigger:
template:
- trigger:
# List of triggers
action:
# List of actions
- sensor: #The dash before sensor makes this a new item in the list under template
# List of sensor configurations, independent from the trigger and action above