I am using settxfee(0.00020) before sendtoaddress RPC call however after sending 0.042 in blockchain a fee of 0.000045 is showing.
How can I set the fee properly ?
What version of bitcoind do you have?
That is known issue about updated bitcoind server. Calculation of transaction size has been changed. Before update, transaction with 255 bytes size was rounded up to 1 Kb and your settxfee value was used. But now, it calculates accurate value of transaction size and calculates fee according to it, without rounding up.