Please read the pinned code formatting post and post code as formatted text, and not as an image.
EDIT: Thanks
As for your question, I think you just need to make this change:
// Note the `?` near the end
let mut f = OpenOptions::new().append(true).create(true).open(filename)?;
.open(filename)
returns a Result
which you have to handle somehow, in case of errors. The ?
will return the error if the result is an error, and otherwise the opened file will be assigned to f
.