You really have not left sufficient time in your itinerary to consider staying one night in Pézenas. The train from Nice to Agde will alone take 6 hours and possibly more depending upon which departure time you want. A taxi will add at least 30 minutes to 45 minutes to the voyage meaning any time you spend in Pézenas will be very short. Consider also that you are there on one of the shortest days of the year, you´ll probably only see the town in darkness unless you leave Nice very early in the morning. I should estimate the taxi at around 60€ to 80€ each way and you´ll probably need to return to Béziers to find or connect to a Barcelona train.
It would make a lot more sense to me to stay in Avignon, Nimes, or Montpellier and have an opportunity to really visit one of these towns rather than rush to get only a glimpse of Pézenas.
we are thinking of spending a week in a village called Margon near Pezenas and want to know if there is a good bus service as we do not want to hire a car to get around.
Any information would be helpful