use graceful way to output large text to file