Because … it’s never used? Show me above where you think you are using the value. I only see you assigning to it, never reading from it. That’s what “using” means in this context.
There are many steps to ground checking, and they are already well understood.
You need a variable - check, you got that
You need to set it when on the ground -check, you got that
You need to clear it (set it to false) when you’re NOT on the ground - missing as far as I can tell
You need to use that variable for whatever you want - missing as far as I can tell.
Since this looks like just a bog-standard basic movement controller, why not start with one of the already-complete ones out there and learn from it first?
Once it’s working, then you can go roll your own and have all the benefit of standing on the shoulders of people who solved this ultra-simple ultra-common problem already.
Here’s a vast repository of random character controllers of various kinds: