refactoring Util

adding limit to print ngramas to file