refactor addErrorsToTxtBuff