Creating line_data objects inside the loops