Here’s how to create a USB flash drive with the full installer of macOS downloaded on it 

1. Download the desired version of the macOS installation app from the Mac App Store. When the download completes, you will see it in the Applications folder.

2. Using a 16 GB or larger drive, format the disk using the settings below, making sure to give it the name usb1.

In Disk Utility, I’ve gone to the View menu and chosen Show All Devices (⌘+2 keyboard shortcut) to get it to appear as below.

After that, I highlighted SanDisk… and then clicked Erase on the toolbar.

3. Open a Terminal app (Applications folder -> Utilities), and run the command for the desired macOS version you have downloaded:

For macOS 10.15 Catalina:
sudo /Applications/Install\ macOS\ --volume /Volumes/usb1 --nointeraction

For macOS 10.14 Mojave:
sudo /Applications/Install\ macOS\ --volume /Volumes/usb1 --nointeraction

For macOS 10.13 High Sierra:
sudo /Applications/Install\ macOS\ High\ --volume /Volumes/usb1 --nointeraction

4. Sit back and wait for the data to be written to the USB flash drive. You will get a message when it has completed.