Hi Vasant,
Thank you for reaching out. You can base your code off of this example. However, you need to use the AdGroupAdService instead. As explained here, if you want to update the status of the Ad, you need to construct an AdGroupAd object and set its status to your desired Ad status.
Regards,
Mitchell
Google Ads API Team