line 14 is not valid java code.
No it does not.. it outputs the first letter of each line instead of the lines with length of one
Please post the code that you are executing that does that.
The code you posted would not compile and can NOT be the code you are executing.
I suggest you make a String with several lines of test data in it and write a small simple program to extract from the String the pieces that you want. Make it a complete self contained program that scans thru the string and parses out the data. For example:
String testData = "First line\nA\nSecond line\nB\n";
Here is a test String that you would want to parse out the A and the B.
Post this complete program when you have problems. It will be something that we can work on for you to get the string parsed.