I play electric guitar and I already know a little of the basics, but I'm having trouble in playing songs. Every time I hold a string down it doesn't make any sound, it just turns mute (this happens with all the strings) please help I've been trying to figure this out.
On the assumption the guitar itself is good, and has no defects along the neck, at the nut or bridge.
Take any string, any fret, and press down, with one finger, at the part of the fret that's closest to the bridge. Press very hard, play that note. Slowly release the pressure, and you'll reach a point where the sound goes. Anything after that, is not going to work. You need a certain pressure, but not tons, to press a string down. Experiment with just how much you need on that guitar. Move that finger to the back of the fret, and realise how much harder you need to press.
Let others play it, as there may be other issues. And watch what they do. If your fingernail turns white, you're pressing too hard. It may be that another finger is touching that string - either hand - so be aware of that too.
There are a couple of stuff that could be going on here. It's hard to figure it out what it is without some pictures of seeing it up close, but:
It could be that the neck is somewhat warped and when you hold down a note, the string is hitting on the fretboard and is not free to vibrate like it should. If this is the case, the neck will need adjustment.
One other thing could be that you are not pressing the string all the way down, i.e. it is not reaching the fretboard and thus no sound is produced, besides the "mute" sound.
I believe the latter is your case, because from your title, you say
when I slightly hold a string down
try holding all the way down, to reach the fretboard and see if that helps. This might be a little difficult if the guitar strings are not set properly, i.e. if the action is too high, making it harder for the string to reach the freatboard.
When you pluck an open string on a guitar, the string is able to vibrate for a time because it is firmly in contact with hard material at two points at either end of the guitar: the bridge and the nut.
If you touch the string at any point between the bridge and the nut, it is no longer able to vibrate and hence will no longer sound, because you are damping it out by touching it with soft material (your finger).
The purpose of a fret is to provide another hard "end point" for the string, which produces a higher-pitch note than the open string because it effectively shortens the string. That is, the length of string between the two "hard points" is now the shorter length between the bridge and the chosen fret.
Because of this, it's important to press just behind the fret. If your finger contacts the string at all between the fret and the bridge, you will damp it out.