I understood how to do it. I have to get the encoded name of the script in groovy which will be:
String name = groovyLoader.getEncodingString(myString); String fileName = "Script_" + name + ".groovy";`