How to convert this to a script

Tags: #<Tag:0x00007f326e979580>

I started a script…

alias: Update HVAC and Preset Mode Options
sequence:
  - service: notify.ha_input_select
    data: {}
mode: single

and want to execute this (code based on another post regarding updating input_select options)…

{% for state in states.climate %}
{{ state.entity_id }}

rest_command:
  update_sonos_playlists:
    url: "http://localhost:8123/api/services/input_select/set_options"
    method: POST
    headers:
      content-type: application/json
      x-ha-access: !secret http_password
    content_type: application/json
    payload: >-
"entity_id": 'input_select.{{ state.entity_id }}_preset_mode"
        
"options": [
{%- for item in state_attr(state.entity_id, 'preset_modes') %}
  "{{item}}"{% if not loop.last %}, {% endif %}
{%- endfor %}
]

{% endfor %}

but I am at a loss as to how the enter it into the script editor.

More info…
service: notify.ha_input_select is a result of:
configuration.yaml:
notify: !include notify.yaml
notify.yaml:

# HA Input Select Options Update
  - name: ha_input_select
    platform: rest
    resource: http://localhost:8123/api/services/input_select/set_options

If there’s an easier/better way to script the above, I’m all ears.
Help!