MEL scripting question (fileI/O,export scene info)

Hello

Does fopen create a new file, if the file I try to open doesnt exist? I need to create a new blank file for writing. No successful attempt at this yet =(
Although it's clear from errors.

How do I traverse through the mesh objects in a scene?
like for (i = 0; meshObjects; i++)....

How do I collect the values to write down with fprint,
like vertices, faces, edges, textureCoords...

I have found the help in Maya, but no good tutorials or examples of what Im trying to do...

Im trying to write a script that exports information into a txt file...that later can be parsed more easily....info like vertices, edges and faces...texture coords and so on...

any help would make me grateful