Your command doesn't work because the redirection
> file is done by the current shell prior to the execution of the command, so before the sudo is in effect.
There is a command, called
tee, that writes to a file and to stdout what it receives on its stdin: this is handy to write something to a file without redirection. If the file can be modified only by root, it is sufficient to prepend
echo 1500 | sudo tee /proc/sys/vm/dirty_writeback_centisecs
Another way to obtain the desired result, mantaining the redirection, is to move the redirection to a subshell executed by root, through
sudo sh -c 'echo 1500 > /proc/sys/vm/dirty_writeback_centisecs'
Lastly, you can enter a root shell in various ways, and you remain root until you
exit explicitly that shell:
For more information see the manuale pages of
su and of course of