Depending on the platform, "write" function may fail if the full
directory path does not exist. So we have to create it before.
## Description
According to this doc https://doc.rust-lang.org/std/fs/fn.write.html
"write" function may fail if the full directory path does not exist. And
it does on macOS with an error "No such file or directory (os error 2)".
I added a create_dir_all call before, to create dir first.
## Test plan
build --generate-struct-layouts flag must work on all platforms. It did
not work on macOS Sequoia
---
## Release notes
- [ ] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [x] CLI: Fixed an issue on the `sui move` command regarding writing
into a non existing directory.
- [ ] Rust SDK:
- [ ] REST API: