Brother the engine is not knocking because of any fault. This knocking is due to low octane number fuel used in Pakistan.
In a manual petrol car, if you accelerate suddenly on wrong (or larger) gear, for example I decelerate and come to 20 Km\h and I have got the ride in fourth gear, it will start knocking if I'll push at the accelerator. The same situation is happening with you too. When you shift to "B", which means low gears, the knocking stops. But because the car is in "B" mode it cannot shift to higher gears. So, on increased speed you need to shift to "D".
As far as I can see, every thing is normal in your ride. Just simply put high octane in it. You will feel a big difference.
Best of luck,