Extract Road Network from OSM

I am new to OSM. I want to convert an OSM file to the following form:

s_1, t_1, lat_s_1, lng_s_1, lat_t_1, lng_t_1

s_2, t_2, lat_s_2, lng_s_2, lat_t_2, lng_t_2

where each line represents a road segment, s_i and t_i are the endpoints of the segment, and lat_s_i and lng_s_i are the latitude and longitude of s_i. What part of an OSM file should I look at to get this information?

What parts of https://wiki.openstreetmap.org/wiki/Routing you have already searched for routing solutions?

In .osm file? Nodes will have locations and ways will be referencing nodes.

To select ways you need to filter based on your needs (what counts as road segment depends on what will be routed)