There are a couple of issues here, presented in descending order of importance
You're already logged in as root, so you don't need to use sudo (or its equivalents). You're already root! All you need to do is run gedit /etc/default/grub.
However, if this is a server, you probably don't have a GUI running at all. That means that graphical applications like gedit won't be able to run and you need a command line editor instead. The simplest of those is nano:
nano /etc/default/grub
The best of them is emacs although some poor misguided people1 insist on using a thing called vim.
If you are running a GUI on your server, this could be happening for a variety of reasons, depending on how you're connecting to it. Please have a look at my answer here, I go through most of them.
1 This should not be taken seriously. That's a long running gag in the *nix community, vim is an excellent piece of software, I just happen to be in the emacs camp. We get pretty worked up about which is best but, in all honesty, they're both great.