H = visualize (S, VisPath => "/PATH/TO/DIRECTORY/")
The default nature of the Visualize package is to open the visualization in a temporary file. Use the VisPath option if you wish to save the visualization to a given directory. If the process will overwrite files, a warning appears asking the user if they would like to proceed. You can squelch this warning with the Warning option.
The source of this document is in /build/reproducible-path/macaulay2-1.25.06+ds/M2/Macaulay2/packages/Visualize.m2:1853:0.