In the code above I see this: std::string no1;
this creates an empty string called no1 with the contents "".
Then further down, afile<<no1;
Well, if an empty string is written to the file, then the file contents will not change, simply because the string is empty.
I'm not sure whether the code you posted has been edited to make it shorter and some of the important parts deleted, or whether it truly does represent the actual code.
But I would definitely expect to see the variable no1 be assigned some non-empty value before outputting it to the file, either by cin >> no1;
or perhaps getline(cin, no1);
... or from somewhere else...