I want to download Xcode that I deleted again. But when I open App Store and search for Xcode the download button is grey
16 GB might be enough to download Xcode, but it might not be enough to install Xcode.

Xcode is delivered as compressed .dmg or .pkg file (I can't remember quite which) and it would be uncompressed upon installation.

16 GB is not a lot of space to run macOS in general.

If you need more space, you might use an app such as OmniDiskSweeper to see if there's anything taking up unexpected space.