Example of Backward Euler and writing to file