Installinstallmacos.py is a script that was written by Greg Neagle. The description reads – A
tool to download the parts for an Install macOS app from Apple's
softwareupdate servers and install a functioning Install macOS app onto
an empty disk image
This script reaches out directly to Apple and downloads all the pieces that form the macOS install app. At the end it will install to a blank dmg image. In the end you have a fresh macOS Install app in a .dmg!
The script is located on Greg’s Github site.
https://github.com/munki/macadmin-scripts/blob/master/installinstallmacos.py
You can download the file directly from this link
https://raw.githubusercontent.com/munki/macadmin-scripts/master/installinstallmacos.py
Opening the link above shows you the raw script. Download it by Right Clicking anywhere on the page and then select Save As. Now that you have the script, let’s run it.
Open up terminal.app. Below is an example how the script would look on your command line.
MacBook-Air:~ mrmacintosh$ sudo /Users/MrMac/Desktop/installinstallmacos.py

Notice that you have 8 versions of full macOS installers available! As of April 9th 2020, the latest version of Catalina is 10.15.4 (19E287). Select 2 (or 6 it’s doubled up for some reason) then hit enter.
The download will start and look like this:

All of the download pieces are downloaded to
/Users/yourhome/content/downloads
Making empty sparseimage...
installer: Package name is macOS Catalina
installer: Installing at base path /private/tmp/dmg.IJe432
installer: The install was successful.
When the download is complete the .dmg will be located at the root of your home folder.