write directly to specified file