(I use Mathematica 9.0.1 on OS X 10.10.2.)
Suppose I have a notebook in which I make some definitions and assignments.
a = 108
b[x_] := 4x + 8
c = Interpolation[{15, 16, 23, 42}]
Then it is straightforward to save these definitions to a text file:
Save["filename.txt", {a, b, c}]
produces a text file filename.txt containing
a = 4
b[x_] := 8*x
c = InterpolatingFunction[{{1, 4}}, {4, 3, 0, {4}, {4}, 0, 0, 0, 0,
Automatic}, {{1, 2, 3, 4}}, {{15}, {16}, {23}, {42}}, {Automatic}]
But is there a way to produce exactly the above content, not in a text file, but in an ".nb" file?
(Note that the obvious first guess, just changing the extension of the filename I specify in the Save command from ".txt" to ".nb", does not seem to work. Mathematica still treats the file as a text file, rather than a notebook file, it just now has a deceptive file extension.)

Save["test.m"]produces a proper.mfile, butSave["test.nb"]just produces a text file with a misleading.nbextension. – thecommexokid Mar 27 '15 at 17:59FrontEndObject::notavail: A front end is not available; certain operations require a front end.– thecommexokid Mar 30 '15 at 06:06UsingFrontEnd. I will be afk for 1h now. – Kuba Mar 30 '15 at 06:14