Change testbench variable from tcl file

Sorry if I misunderstood your question. But wondering why you would not use a shell command
to redirect the output to a different file. Any reason why this should be done in the SystemVerilog layer?

If you need to change the output file locations in the SystemVerilog layer, you may have to use plusargs to send in a directory name (the directory name would be different for each run).