str="xyz\nabcd\n";
char buff[]=new char[str.length()];
str.getChars(0,str.length(),buff,0);
try{
File f1=new File("/logs","temp.txt");
FileWriter fo=new FileWriter(f1);
fo.write(buff);
fo.close();
}catch(IOException ioe){
}
This way i created the file.