Since stext is used in the token manager you should declare it as follows
TOKEN_MGR_DECLS: {
PrintStream stext = new PrintStream(new File("3S.txt"));
}
Having done that, you will be able to use stext in token actions. Consult the documentation at https://javacc.java.net/doc/javaccgrm.html#prod12 for more information.