May be after the Data Processing is done you can use the following inbuilt service to wrie to a Flat File.
sample.IO.test:writeToFile
This flow takes the string and writes into the flat file according to the specified path.
Map the string in Pipeline In to fileContent in Service In and Hard Code the filename as the Path name of the file where you want to write.
#Integration-Server-and-ESB#webMethods