When `.env` already exists in `.gitignore`, the method appends an unnecessary newline. Skip the write entirely if no patterns need to be added.