fix write_on_file nxos_snapshot (#30545)
fix write_on_file nxos_snapshot (#30545)

* fix write_on_file nxos_snapshot

Signed-off-by: Trishna Guha <ce185bc4d02177cfb8b83f6e4ec8fbdf1e25eaef@gmail.com>

* some more logic

Signed-off-by: Trishna Guha <ce185bc4d02177cfb8b83f6e4ec8fbdf1e25eaef@gmail.com>

thaim/ansible,thaim/ansible