I need to write a shell script to start and stop an android service .
You need to add android:exported="true" to start service from ADB command line. Then your manifest looks something like this:
And then from ADB
To start service:
adb shell am startservice com.your.package.name/.YourServiceName
To stop service (on Marshmallow):
adb shell am stopservice com.your.package.name/.YourServiceName
To stop service (on Jelly Bean):
adb shell am force-stop com.your.package.name