Two Free Apps for Mac OS Installation Ease
Mac Apps
On most modern Macs, the later Intel builds and all Apple Silicon
models, you can boot into recovery mode, access disk utility and
download and install a new operating system. Unless you can't. Then you
have a problem. Or, maybe you are experimenting with Open
Core Legacy Patcher to install a later version of macOS on a device
that doesn't officially support it. In that case, you are going to need
a copy of an OS, preferably bootable, and some sort of media to copy
that OS installation onto. You can do the installation through other
methods, like target disk mode or various imaging applications too, but
they take some know how. The other thing you can use these files for is
when experimenting with virtual machines in something like Virtual Box,
UTM or VMWare Fusion.
Mist
To get a copy of the firmware and OS you need, I know of no easier method than using Mist, a free app available on GitHub. With Mist, you can get everything from the latest beta, all the way back to Mac OS X 7.5. You can get Intel or Apple Silicon installers, or the universal installers available for macOS Big Sur and later.
Balena Etcher
If you are planning to use an SD card or a USB drive, things work better when you flash the media than when you try to fiddle with partitions and permissions on your own from the command line. Luckily, there is an app for that. It is Balena Etcher, a free app with built-in safeguards to keep you from erasing the wrong drive. Balena Etcher will also create bootable media for Windows and various Linux builds too.