adding file input and output  AND APPNED