On my existing mac i usually reinstall or upgrade by downloading the OS and performing a clean install.

First we need to open AppStore to Download latest macOS Ex: macOS Ventura or Sonoma

Follow instructions given here: https://support.apple.com/en-us/HT201372

Primary command that you will need to run:

sudo /Applications/Install\ macOS\ Ventura.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolumebash

Here MyVolume is the USB Volume name, which needs to be changed to match yours.

Shutdown and Start your mac by holding the power button down (M1 style). Enter Disk Utility to Erase the disk, followed by reboot and install via USB.