That directory and it's files are probably not owned by your user, or it's group.
Adding your user to the group that owns the directory and/or the files will likely allow you to do that. However that's a bad solution. A good solution would be do your work on a directory within your home directory and then deploy the work to /var/www if needed.
Most modern web frameworks allow to run a development server on an unprivileged port and serving specifically only the project were you're working on. Alternatively configure your web server to serve a vhost for a directory that contains your project within your home directory.
ls -la /var/www
– NerdOfCode Dec 17 '17 at 20:17