Write function not getting executed in monitor

Please format you code with markdown tags.

You could read about it in the post below: