You need to download the version you want/need from the app store. Then it will appear on your Applications folder. You won't run that installer, you can close it and just proceed with the following steps.
sudo hdiutil create -o /tmp/macOS -size 10000m -volname macOS -layout SPUD -fs HFS+J
sudo hdiutil attach /tmp/macOS.dmg -noverify -mountpoint /Volumes/MacOS
sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/macOS
sudo hdiutil detach /Volumes/Install\ macOS\ Catalina
hdiutil convert /tmp/macOS.dmg -format UDTO -o ~/Desktop/macOS.cdr
mv ~/Desktop/macOS.cdr ~/Desktop/macOS.iso