This problem appears to be post-void dribbling where a few drops of urine trickle out after you have emptied your bladder. It is distressing and is attributable to the fact that some urine remains in the urethra (urine passage) which is gradually squeezed out afterwards. A good technique is to relax completely while passing urine and spend an extra time afterwards so that all the urine drains out. If the problem persists, consult a urologist in your town / city who will prescribe some medications. Masturbation has nothing to do with this.