Based on your description, I think you're trying to install macOS on your USB flash drive, which is not necessary if you just want to create a bootable USB installer. But regardless, you can try the following steps instead:
Step 1: Download the needed macOS installer from App Store
Step 2: Format your USB flash drive to Mac OS Extended (Journaled) in Disk Utility.
Step 3: Open Terminal and execute the following command to create a bootable installer for macOS High Sierra and later. (Replace Ventura with the name of the macOS version of your downloaded installer.)
sudo /Applications/Install\ macOS\ Ventura.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolumeFor more information, check this guide:
Complete Guide on How to Create A Bootable Installer for macOS
After the bootable drive is created, you can boot from it to install macOS on your Mac or the USB drive if you want.