And..
There is evidence that the script is running from cron.
Because the mkdir statement does not contain a full path it has probably created a directory called:
/healthcheck.log
on a previous run. Therefore it still exists.
If we guess that the intention is to create a directory called /apps/cron/healthcheck.log the script needs the full pathname.
if [ -d /apps/cron/healthcheck.log ]
then
echo "directory already exists"
else
mkdir /apps/cron/healthcheck.log
echo "directory created" >> $_LOGFILE
fi
The value in $_LOGFILE will need to be a full pathname too. The environment for cron is not the same as the user environment.