It's rather clunky to read each value one at a time, but it's natural in M- to read them all at once and then process each one.
Here's a simple infrastructure I use all the time:
(* step one: get data *)
data = Import["ideone_fM0rs.txt", "Lines"];
(* step two: ??? *)
res = {};
Module[{value, result},
value = #;
result = yourCodeHere[value];
AppendTo[res, result];
]& /@ data;
(* step three: PROFIT! *)
Export["out.txt", res, "Lines"];
but see Jon McLoone on AppendTo vs Sow/Reap for large data sets: http://blog.wolfram.com/2011/12/07/10-tips-for-writing-fast-mathematica-code.
Here's a variation with Sow/Reap for the times you'd like to collect values under various tags or categories or genuses or whatever:
data = Import["ideone_fM0rs.txt", "Lines"];
res = Reap[Module[{value, result, tag},
value = #;
result = yourCodeHere[value];
tag = generateTag[value]
Sow[result, tag];
]& /@ data, _, Rule][[2]];
Export["out.txt", res, "Lines"];
It's tempting to roll all that up into a single awe-inspiring one-liner, but for maintainability I like to keep it unrolled with each step made explicit.
Of course, yourCodeHere[value] could instead be many lines of well-commented code.
Note: I downloaded your data to a local file ideone_fM0rs.txt
using the download link at http://ideone.com/fM0rs