The steps to create the bootable macOS USB installer are as below:
The original OS X version is Mountain Lion 10.8.5.
Go to the Mac's App Store and get the latest macOS.
Quit the macOS installer.
The installer may be found in the Applications folder of Finder:
Application\Install macOS Sierra
Open the terminal and type this command:
sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/MyUSB/ --applicationpath /Applications/Install\ macOS\ Sierra.app/
For other paths for USB drive or Sierra.app or for installing other OS X versions, refer to Apple's official document: Create a bootable installer for macOS.
Now the USB drive has been successfully formatted as a bootable macOS installer.
Create a bootable installer for macOS