Is there a script I can use to download the Mojave installer without being signed in to the App Store?
There is a very well documented open source script that reads the software update catalogs and parses them for the major macOS installer components, prompts you which build and version to download and will then commence to download each portion to your filesystem and then build an installer application or image based on the options you choose.

https://github.com/munki/macadmin-scripts

The python script named installinstallmacos.py has this description:

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 tool is updated for macOS 10.15 Catalina.