Correct configuration.yaml to current syntax, need help

I know this is not correct syntax, unfortunately my skills are not as good to correct it, could some one help me out.

# tamplate
template:
# Formatierte Zeit "Di, 23 Mai 2023, 17:46" 
  - sensors:
      time_formatted:
        entity_id: sensor.formatierte_zeit
        unique_id: sensor.formatierte_zeit
        friendly_name: Langes Datum
        value_template: >
          {% set wochentag = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"] %}
          {% set monat = ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"] %}
          {% set wochentag = wochentag[now().weekday()] %}
          {% set monat = monat[now().month - 1] %}
          {{ wochentag }}, {{ now().day }} {{ monat }} {{now().year}}, {{ now().timestamp() | timestamp_custom('%H:%M') }}
        icon_template: mdi:calendar-clock

Thanks in advance