Still guessing as you show no examples.
You can feed a topic in to the mqtt out node. So you can save the prefix as a global, then use a function or change node to prefix the topics. I have prefixed them in the inject nodes in this example.
Just set the prefix
[{"id":"6a302d09687e4d68","type":"subflow","name":"set mqtt sub paramater","info":"","category":"","in":[],"out":[{"x":580,"y":20,"wires":[{"id":"d070c746cc388a55","port":0}]}],"env":[{"name":"sub_string","type":"str","value":"please set","ui":{"label":{"en-US":"mqtt prefix"},"type":"input","opts":{"types":["str"]}}}],"meta":{},"color":"#DDAA99","status":{"x":600,"y":100,"wires":[{"id":"d070c746cc388a55","port":1}]}},{"id":"04904b5d1eed1e6d","type":"inject","z":"6a302d09687e4d68","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.1","topic":"","payload":"","payloadType":"date","x":170,"y":20,"wires":[["d070c746cc388a55"]]},{"id":"d070c746cc388a55","type":"function","z":"6a302d09687e4d68","name":"function 11","func":"let param = env.get(\"sub_string\") || \"please set\";\nmsg = [{topic: param},{status:{text: param}}];\nglobal.set(\"mqtt_prefix\", param)\nreturn msg;","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":40,"wires":[[],[]]},{"id":"01cd665373cb4cef","type":"subflow","name":"Subflow 1","info":"","category":"","in":[{"x":40,"y":80,"wires":[{"id":"fefb4c0d6c852023"}]}],"out":[{"x":340,"y":80,"wires":[{"id":"fefb4c0d6c852023","port":0}]}],"env":[{"name":"topic","type":"str","value":"/test/test","ui":{"label":{"en-US":"Enter Topic"},"type":"input","opts":{"types":["str"]}}}],"meta":{},"color":"#DDAA99","status":{"x":340,"y":160,"wires":[{"id":"fefb4c0d6c852023","port":1}]}},{"id":"fefb4c0d6c852023","type":"function","z":"01cd665373cb4cef","name":"function 12","func":"const topic = env.get(\"topic\") || \"/test/test\";\nconst mqtt_sub = context.get(\"topic\");\nconst new_mqtt_sub = msg.topic;\nmsg.topic = mqtt_sub + topic;\nmsg.action = \"unsubscribe\";\nnode.send(msg)\nmsg.topic = new_mqtt_sub + topic;\ncontext.set(\"topic\", new_mqtt_sub);\nmsg.action = \"subscribe\";\nreturn [msg,{status: {text: msg.topic}}];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":190,"y":80,"wires":[[],[]]},{"id":"618f6119970f3c65","type":"link in","z":"452103ea51141731","name":"link in 1","links":["5f71c25083234615"],"x":225,"y":1140,"wires":[["584f086f99bb4386"]]},{"id":"584f086f99bb4386","type":"subflow:01cd665373cb4cef","z":"452103ea51141731","name":"/test/test","x":340,"y":1140,"wires":[["8c4b454db7df7149"]]},{"id":"8c4b454db7df7149","type":"mqtt in","z":"452103ea51141731","name":"","topic":"","qos":"2","datatype":"auto-detect","broker":"e8ba3ef5.22f4a8","nl":false,"rap":true,"rh":0,"inputs":1,"x":490,"y":1140,"wires":[["0dfc13eeaa228c49"]]},{"id":"0dfc13eeaa228c49","type":"debug","z":"452103ea51141731","name":"debug 94","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":1140,"wires":[]},{"id":"e36c75a1b2dfc890","type":"link in","z":"452103ea51141731","name":"link in 2","links":["5f71c25083234615"],"x":235,"y":1200,"wires":[["ed37061f517a0348"]]},{"id":"ed37061f517a0348","type":"subflow:01cd665373cb4cef","z":"452103ea51141731","name":"/test/test1","env":[{"name":"topic","value":"/test/test1","type":"str"}],"x":350,"y":1200,"wires":[["d34256616ff69f7c"]]},{"id":"d34256616ff69f7c","type":"mqtt in","z":"452103ea51141731","name":"","topic":"","qos":"2","datatype":"auto-detect","broker":"e8ba3ef5.22f4a8","nl":false,"rap":true,"rh":0,"inputs":1,"x":490,"y":1200,"wires":[["a3f09deb8fdd24db"]]},{"id":"a3f09deb8fdd24db","type":"debug","z":"452103ea51141731","name":"debug 95","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":740,"y":1200,"wires":[]},{"id":"964d78d4fdf8fbe4","type":"subflow:6a302d09687e4d68","z":"452103ea51141731","name":"Enter prefix","env":[{"name":"sub_string","value":"test2","type":"str"}],"x":210,"y":1080,"wires":[["5f71c25083234615"]]},{"id":"5f71c25083234615","type":"link out","z":"452103ea51141731","name":"link out 1","mode":"link","links":["e36c75a1b2dfc890","618f6119970f3c65"],"x":395,"y":1080,"wires":[]},{"id":"5fa7aaa8f52552e3","type":"inject","z":"452103ea51141731","name":"test/test","props":[{"p":"payload"},{"p":"topic","v":"$globalContext(\"mqtt_prefix\") & \"/test/test\"","vt":"jsonata"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":1300,"wires":[["f9a4e5387ed440e6"]]},{"id":"81b4ddae6445d6fa","type":"inject","z":"452103ea51141731","name":"test/test1","props":[{"p":"payload"},{"p":"topic","v":"$globalContext(\"mqtt_prefix\") & \"/test/test1\"","vt":"jsonata"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":1360,"wires":[["f9a4e5387ed440e6"]]},{"id":"f9a4e5387ed440e6","type":"mqtt out","z":"452103ea51141731","name":"","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e8ba3ef5.22f4a8","x":690,"y":1340,"wires":[]},{"id":"e8ba3ef5.22f4a8","type":"mqtt-broker","name":"testb","broker":"192.168.1.25","port":"1883","clientid":"node-red-test","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
[edit] added status messages to subflows.