How to execute a terminal command at startup

Hi, I set up an WiFi connection with

nmcli c add type wifi con-name <connect name> ifname wlan0 ssid <ssid>
nmcli con modify <connect name> wifi-sec.key-mgmt wpa-psk
nmcli con modify <connect name> wifi-sec.psk <password>
nmcli con up <connect name>

The problem is after every startup I need to use the

nmcli con up <connect name>

command. So I wanted to make a script which Home Assistant uses at startup so it connects automatically to the network at startup. But how do I make a script like this?