Platform independent new-line handling is often problematic, but using \n is usually OK.
I'm not fluent in Java and don't have an easy way to build your code and experiment with it. It is odd that on Windows (my platform of choice, too) that writing strings with \n in them are not being translated to the platform's new-line, but the "bw.newLine()" is writing a platform specific new-line.
The Coursera grader is running on Linux and I would expect \n and newLine() to write identically.
There's one thing I see that you can try:
There are 4 code generating lines that do not end in \n
java:81: myout = "//" + line + "\n@" + fname + "." + cons + "\nD=M\n@SP\nA=M\nM=D\n@SP\nM=M+1";
java:89: myout = "//" + line + "\n@" + cons2 + "\nD=M\n@SP\nA=M\nM=D\n@SP\nM=M+1";
java:131: myout = "//" + line + "\n@SP\nA=M-1\nD=M\n@SP\nM=M-1\n@" + fname + "." + cons + "\nM=D";
java:139: myout = "//" + line + "\n@SP\nM=M-1\n@SP\nA=M\nD=M\n@" + cons2 + "\nM=D";
These lines are associated with push/pop static/pointer
Since the problem showed up in StaticTest, try adding the \n to the ends of those 4 lines so that they will be identically formatted to the code written for the earlier passing tests.
(This might be a good excuse to try to get Java SDK installed on my Linux laptop and see if I can build your code... Something to do when I get done with work.)