added usage details to main.cpp
added direct output file writing instead of cout