In Linux, the sudoers file present in the /etc directory will determine the permissions and other settings while the sudo command is used. If you edit the file directly using terminal or using an editor, if there is any error in your code, the whole sudo command will break. So it is not the best way to edit the sudoers file.
The best way to edit the sudoers file is to use the following command :
$ sudo visudo
This will open the sudoers file in vi editor and you will be able to edit the file here. Once you try to save, it will check for errors and will let you know the same with options to save, not save or re-edit the file.
So it is the safer option while trying to edit sudoers file.