You can combine two examples that ship with LabView. From any LabView window, goto Help >> Find Examples >> Search >> Type a keyword to find.
Enter serial, then click on serial under Select a keyword to display related examples. Select LabVIEW <-> Serial.vi. You'll see how the serial port is initialized, written to, and read from.
Then, back in the Find Examples window, Type a keyword to find: datalog. Click on datalog files the Write Datalog File Example.vi. Instead of using Acquire Data (Simulated).vi, you can use another example vi, Serial Read with Timeout.vi. Before you start your acquire loop, you'll need to open the serial port like in LabVIEW <-> Serial.vi.