I have explained operation of a PI controller in my answer to Understanding the flow of a PI Controller?. You might find it useful to read that as it gives a simple example of what happens the P and I terms in a cruise control system.

*Figure 1. The classic PID control function. Source: Wikipedia - PID controller.
I mentioned in my linked answer that it had dawned on me rather late in life that as the integral action corrects the output the error falls to zero so the contribution of the proportional control also falls to zero. The output when the error is zero is maintained purely by the integral action.
I understood that output of integral block will be zero ...
No, it won't. The output of the integral block will be KP times the arithmetic sum of all the errors since the system was started. (There may be an anti-windup feature to limit the maximum integral error.)
... but what about output of derivative block?and what will be reason for that output(If non zero output)? Apparently it seems that output of derivative block will also be zero since mathematically derivative of zero is also zero.
The derivate output is proportional to the rate of change of the error. In my cruise control example this value will be non-zero if the set point suddenly changes (you bump the setpoint up or down 10 kph) or the vehicle's velocity changes due to a change in the road's slope. The system then reacts much more quickly than it would if waiting for PI control only.