Direct file write instead of memory consumpion

There is no need of storing $sql_file and $output in memory, this will only make this script unusable on large databases ("Fatal error: Allowed memory size of XXX bytes exhausted" bug). Should write stuff directly to file.
SET NAMES to utf8 FTW

Just to be sure to get correct Unicode file.
Merge pull request #3 from Ritsuka/master

Memory usage improvement, write to file instead of appending variable.