in the Java snippet I create the necessary file path and name dynamically. I like to use the KNIME-protocol that works with relative paths which I strongly recommend you would use. It makes sure you can pack and copy your workflow ensemble everywhere and it will still work.
knime://knime.workflow/…/result/
In you case the syntax in the Java Snippet might look like this
return “knime://knime.workflow/task2/result/” + $${Scombined string}$$ + “.txt” ;
if indeed your task2 folder is beneath your current KNIME workflow and has a subfolder called result. If not you would have to specify the location where your CSV files should be stored.