The external keyboard that I've been using is Coolermaster Masterkeys Pro L on a Dell Inspiron. And while gaming or typing in general, when I hold a specific key, the pc lags. While playing pubg too, i can't run continuously by holding 'W' key for example. The keys function properly only when I press it multiple times, but doesn't work properly while holding a key and my laptop lags. Please help me
Well if you have been using it, holding down that particular key, for a while now, you may well have damaged the connections so that the button will now only work when pressed repeatedly. Depending on the keyboard, it may allow for replacement of individual keys (internal key parts, not external) however many keyboards don't have this option. If that is the case, then you would have to replace the entire keyboard. or use it with the multiple push.
As to the lagging, most computers are not meant to work with you holding down a key for any period of time (keyboards aren't made for that either) so it is completely normal for a system to start having issues if you are doing this. It will be worse with certain programs and/or if running more than one at a time.
I would start with the resolution of the key issue, either replacing the part (if possible on that keyboard) or getting a new keyboard and see if this resolves all of it.
Additionally, make sure you reboot (power fully off and back on) the laptop regularly as this will help speed things up.