What you have works for me:
$ cat test-shell-exit
#!/bin/sh
check()
{
printf "Would you like to try again?\n"
read S
if [ "$S" = "y" ]
then
echo Try again
else
echo Done
exit 0
fi
}
echo Before
check
echo After
$ ./test-shell-exit
Before
Would you like to try again?
y
Try again
After
$ ./test-shell-exit
Before
Would you like to try again?
n
Done
Could you try this test case and update your answer with any differences from it? It appears the problem you're running into is caused by something you haven't mentioned.
Update: Example of using a loop instead of calling your program again:
$ cat test-shell-exit
#!/bin/sh
check()
{
printf "Would you like to try again?\n"
read S
if [ "$S" = "y" ]
then
echo Try again
else
echo Done
exit 0
fi
}
while true; do
echo Before
check
echo After
done
$ ./test-shell-exit
Before
Would you like to try again?
y
Try again
After
Before
Would you like to try again?
y
Try again
After
Before
Would you like to try again?
n
Done