I found the cause of issue and fix as well.
The problem was while I was running kubectl command, the kubeconfig was trying to generate the access token on the fly for which ssm was not having required access.
As soon as I hardcoded the token value in script, it started working from system manager run command as well.
Now the only problem I had is token expires every 15 min, which I can update every time I run the script, within the script itself.
Hope this helps!!