I am not quite sure what you mean by "this": you show a script (without a specified name) producing another script (named "somescript.sh").
If you want the original noname-script to be executable, then put its text into a normal file (i.e. /some/where/script.sh ) and issue this command:
chmod 754 /some/where/script.sh
This will make it executable for the owner (7) and the owners group (5), which most times makes sense. If you have special security considerations this might have to be changed.
If you just want the created script ( somescript.sh ) to be executable then add this to your script:
You really should not use /bin - a link usually to /usr/bin - for anything.
Bakunin (some others ) posted a long dicsussion of how this can make trouble for you. I cannot find the link at the moment, perhaps he can find it for you.