Because Germany will pay them back handsomely
Germany is currently running a campaign against illegal immigration to appease the general public and reduce AfD’s electoral prospects. It started with Scholz’s statement in August that made it sound like Germany is about to get serious about immigration law enforcement:
Mr Scholz also said his government would have to do "everything we can to ensure that those who cannot and should not stay here in Germany are repatriated and deported" and that deportations would be sped up if necessary.
In late August they’ve deported 28 convicted Afghani criminals back to Afghanistan, despite not recognizing the Taliban government. And now “Robert A.” became an unlucky scapegoat (out of millions of illegal immigrants) whose deportation will be used to prove that Scholz is “tough on immigration”.
There’s no public proof but we can reasonably expect that Serbia will be paid handsomely for their cooperation, via EU/German grants, assistance with speeding up EU membership or other similar favors. It doesn’t even have to be a direct quid-pro-quo: Serbian politicians understand all too well that accepting a single Yugoslav man is a tiny price to pay for future German concessions.