Want to get 20 KHz frequency but I am getting 31 KHz frequency on arduino

In the datasheet you will find the formula for PWM frequency. You can get really course control by setting the prescale but to get fine control you will need to set TOP as well.