How do I calculate error on each node?

Please see the attached tutorial:
https://fenicsproject.org/pub/tutorial/html/._ftut1004.html#___sec35

For writing xdmf files, see for instance: Loading xdmf data back in - #4 by dokken