In order to save the memblock mesh as a X file, you'll need to look into the .X file format. There's two versions of .X files, those being
Binary and
ASCII. The later would be easier to use, since you can open them in a text editor to verify the output.
To build your .x means dumping the header (which will be basically be the same for any mesh) then dumping the list of vert's, faces and any materials(textures). I'd ignore materials to start with and just get it working.
http://local.wasp.uwa.edu.au/~pbourke/dataformats/directx/