I\'m not sure if this is a cleaner way of writing this, but I think I don\'t have problems here:
I tend to use double quotes for the echo and single quotes within that
echo "Hello string test ' ";
or you can use the escape \
echo "hello string test \" ";
Also in your code you are doing an echo within an echo.