How to toggle sprint cancel movement when no input?

Hi, I’m trying to make it so that my toggle sprint can cancel when slowing down movement, and with the code I have right now, my character sprint in place like their doing the running man, if anybody has a fix for this, please let me know.