Use JXL or POI Package to write your outputs to XL spread sheet.
If you want to write your Console to text file use like this..
<font class="small">Code:</font><hr /><pre>
// Declare a Print Stream pointing to your output file.
PrintStream out = new PrintStream(new FileOutputStream("output.txt"));
// And set system out to this printstream as below.
// After this all System.out.println()
//out puts will be logged to this text file.