Is there a "latch" node in animation nodes?
You can use a custom property on an object to do it :
Create a new empty and set your node tree like so :

Now when you toggle the boolean input, the custom property is updated and persists between frames.

Now there may be more efficient ways to rig it but your latch logic boils down to :

In action :