Ulrich,
From what I understand, in your first example, you are saving an expression, your second example, you are saving a procedure.
I recommend using Set and not SetDelayed for the first case. Using your example:
Put[x^2, "test.m"];
g[x_] = Get["test.m"];
g[2]
4
This is not unique to Put/Get. Anytime you need to evaluate an expression and then convert it to a "function", I find using Set (=), to be more clear than trying to deal with Holding, etc.
As to your second example, I would consider using Save[] or DumpSave[] to save your procedure. For example:
In[1]:= ff[z_] := Block[{n}, n = 1; Do[n = n + 1, {z}]; Return[n]]
Save["test.m", ff]
Clear[ff]
Get["test.m"]
ff[3]
Out[5]= 4
The difference is that the Block expression must be delayed so I would use SetDelay here and save it as a function. I hope this helps.
Regards,
Neil