Generating PWM from PID to control DC motor

sir i m confused if i write analogwrite(pin,pid output) then how i configure that output wave is square wave and its frequency is 20kh and i m not good programmer main problem is that