I'll go out on a limb and guess that any directory your user has permission to write to is mounted as noexec, which means that you will not be able to directly execute anything. To run a shell script despite this, you can always do
bash script.sh if doing
./script.sh fails with a permission denied error. You should try looking for any directory you can write to which you can also execute from. If none exist, then even having gcc would not help you, since you could not execute the code it generates.
In order to exploit DirtyCow, you need to invoke a number of system calls. This cannot be done from within a shell script. You either need to use a sufficiently sophisticated scripting language such as Python and re-write the exploit in it, or you need to compromise a binary that you have the rights to run and make it run shellcode to perform the attack. If you aren't able to do that, I suggest you practice binary exploitation and shellcode development first to learn how, or this will be quite hard.