He had some gains from this, as Law used hs medical abilities and the power of the devil's fruit to restore the limbs in the inhabitants of the island.
But Law told him to not inform Doflamingo of the fact that he is staying there. (Later i would see that Doflamingo an Law had been enemies for years)
Didn't this alarm Caesar? What are the reasons that Caesar believed, Law would want to stay in Punk Hazard?
He didn't question Laws agenda or motivations at all?