I've put something VERY basic together where it'll write 10 values to a flat file in a single column - you didn't say anything about infile presentation or anything like that - im sure the real coders would do something more efficient/better - but without knowing more details - this will do the job of what you asked.
//below script will write 10 values in a single column in the file in a newly created file
File file = new File("C://Users/Rich/Downloads/groovytest.txt")
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta