Template result ist not shown in dashboard card

I just started with configuring Home Assistant and tried to integrate sensors that include information from json output for the fuel prices of gas stations. The entities work and I can see that the attributes are available in the entities list.

I created a dashboard card and tried to fill in the name of the gas station via a template.

When I test the template with the Template Editor, I receive the correct result:
Unfortunately it doesn’t work on the dashboard card:

Here is my code:

type: entities
title: null
entities:
  - entity: sensor.benzinpreis_tankstelle1
    icon: mdi:gas-station-outline
    name: '{{ state_attr(''sensor.benzinpreis_tankstelle1'', ''name'') }}'
    secondary_info: last-updated
show_header_toggle: false

Result:
grafik

It seems to be a syntax problem but I spent several hours of searching the web for help and wasn’t able to fix it.

You can’t template in the frontend. You also don’t need a template here, the entity by default will have the name that’s set on it.

Thanks for your reply!
The problem is that the name of the gas station changes daily because the cheapest price is always at the first position of the json file. and if i dont fill in the name the name of the sensor is filled in ( so “benzinpreis_tankstelle1” instead of e.g. “Shell”.

Where do I have to create the template to access it in the frontend and how can I access it?