It might be creating the file, but not with a name you are expecting. Try instead:
Code:
echo $PID > "$filenameWithPath"
If this doesn't help, echo the output of each variable as a debugging aid.
I'd also suggest for readability, reducing to something like:
Code:
basedir="/tmp/"
pidfile="$basedir/onboard-at-gdmlogin-display-${DISPLAY}.pid"
...
echo $PID > "$pidfile"
MrC