Added a check for existing file and append output if found