Actually, your program is written in C++. C is a completely different language, which is why it has its own forum. Try to keep your languages straight. Unless your statement is unrelated to the rest of your post, in which case it's out of place.
[...] I only recently started with C.
How about a semicolon here?
Why do you keep opening and then closing the file? This is much more efficient, and won't cause the file to be clobbered with every character that you write to it.
Also, you should include <cstdlib> for system() if you must use system() (it's unportable, slow, and insecure; see the FAQ for alternatives), and the same header file anyway for EXIT_SUCCESS.
using namespace std;
int main ()
cout << "Enter the max number: ";
cin >> m;
cout << "Enter the starting number: ";
cin >> n;
while (n>=0, n<m)
cout << n << " ";
myfile << n;
And an alternative to this
Note that you don't check to make sure that the file could be opened, which is a very good idea.
 And the loop thing that anon mentioned. [/edit]