You cant use templates in standard Lovelace.
There are two custom cards that can enable the ability to use templates in Lovelace:
JavaScript
Jinja
I highly recommend the JavaScript version as it will put much less of a load on your system.