An axis event will always trigger every frame. If you just want to get an event when someone is pressing a key use an action mapping but the axis event will each frame fire an exec impulse.
The normal way to work with this is to multiply your movement with the axis value. Like that if the key isn’t pressed you get 0 as result which will cause no movement because 0 * X = 0. You can also use the “Compare” node. If it’s larger than 0 call the forward function, if it’s smaller the backwards one and if it’s equal do nothing.