If dotdot can't be opened it fails. So I don't think creat was the same as what we now know.
It looks like the code opens dotdot, and then scans through it for something (match for dir?).
The creat call might mean "open for writing", and possibly the flags mean append. It appears dir is appended to the dotdot directory file.
So maybe, add this "dir" entry to dotdot if it isn't there already?
I can't guess what initializes dir; maybe it somehow comes as an argument from the command line or whatever.