I was able to reproduce your problem. Here is an updated example, that works, using your added code and two additional lines of code to inform the Results Log of your output. The first line informs the Results Log that output is coming. This causes the Results Log to output a header for your output. The last line tells the Results Log that the we are done with our output.
void test_str_write()
{
LT_execute("type.beginresults()"); //-------- begin Results
string str;
for( int n = 1; n <= 10; n++ )
{
str.Format("text line %d.\r\n", n);
str.Write(WRITE_OUTPUT_LOG);
}
Worksheet oWorksheet;
PageBase oPageBase;
oWorksheet.Create();
oPageBase = Project.Pages();
oPageBase.Rename("Test");
LT_execute("type.endresults()"); //-------- end Results
}