Hi Aravin,
You will only need to use one of the codes depending on what you are looking for. If you are looking to modify your keywords (such as it's bids), use the keyword selector. If you want stats on your keywords, I'd recommend using reports. Here is a
guide on reports and how they are beneficial.
Both of the codes I gave you include an optional line if you are only interested in a subset of campaigns. For the reports it's the line that says 'WHERE CampaignName CONTAINS "campaign" ' + and for the selector it's .withCondition('CampaignName CONTAINS "campaign"'). If you are interested in keywords in all campaigns, just remove those lines respectively.
Here is the snippet of code I'd recommend using if you want keyword stats from all of your campaigns: