mwrite_yaml function

Write model code to yaml format