Export railroad line with stations

Hello I am wishing to extract a railroad line with all the stations that this line crosses, ignoring if the stations are no longer in use and I wish to omit the level crossings. How do I do this? I have been trying for some days to extract the data precisely and I am not succeeding. Can someone help me?

My query:
nwr"name"=“Ferrocarril Mitre: Córdoba → Retiro”;
nwr"name"=“Ferrocarril Mitre: Retiro → Córdoba”;
// print results
/added by auto repair/
/end of auto repair/
/added by auto repair/
/end of auto repair/
out meta;/fixed by auto repair/

out meta qt;/fixed by auto repair/

text : name;
color: blue;