Thanks for your query,based on the facts that you have posted it appears that you have infection of the Rt epididymis
and testes.(Epididymo Orchitis) and it is not related to surgery for Piles .
It is just a coincidence and not due to any injury to Pudendal Nerve
as you suspect it to be.
Pudendal nerve never gets injured in surgery for piles.
Please take broad spectrum antibiotics like Cefotaxime
along with anti inflammatory medication like Diclofenac
twice daily .
It should get cured within a week.