[percolation] Moved commonly used formatting code to own function
[percolation] Moved commonly used formatting code to own function

The code to format the output file names was repeated in the different file
writing functions. Therefore it was moved into its own function to remove
repeated code and to make future output function shorter to write.

cerisola/fiscomp,cerisola/fiscomp,cerisola/fiscomp