If your only goal is to make a level editor wouldn’t it make more sense to export the entire terrain and re-import that? Or is there something specific you’re need with the height map and texture?
Do you have a 2D array of all the terrain’s heights? You can save that array to a file and reload it. Though the serialization approach might do some of this automatically, not sure.