Just call procedure with your Richedit as Parameter:
procedure add_text(MsgBox:TRichedit;const text : String);
begin
MsgBox.SetFocus;
MsgBox.SelStart := MsgBox.GetTextLen;
MsgBox.Perform(EM_SCROLLCARET, 0, 0);
MsgBox.SelText := time_stamp + ' ' + text + #13#10; //time_stamp is a function
end;