Wouldn't something along these lines work?
string testProgram = programline1 + Environment.NewLine +
programline2 + Environment.NewLine +
programline3;
SomeRoutineToWriteToTheDatabase(testProgram);
Use the string class's + object a lot is inefficient, and you'd probably
want to use a StringBuilder object instead.
If that's not what you're looking for, I think I'd need a clearer
picture of what you're trying to do.
RobR