Is this the only code you've written? Because you're right, none of it would work.
while true do
os.pullEvent("redstone")
print("Line 2 Track 4")
if rs.getInput("back") then
print("Line 2 Track 4")
print(" Careful Boarding into train")
print(" Train is Here")
shell.run ("test")
end
end
This code is nearly exactly what you've written, and shouldn't have any errors, but to me, it seems that you're missing a huge portion of what you'd actually want.
If I read it right, you want it to constantly write "Line 2 Track 4" until it recieves a redstone signal from the top side of the computer.
while true do
--#Clear the screen at the start of every loop
term.clear()
term.setCursorPos(1,1)
--#Write initial message
write("Line 2 Track 4")
--#Wait for an event, and put the parameters into a table
local events = {os.pullEvent()}
--#If the event recieved is the one we want, continue to the rest of the code, else restart the loop
if events[1] == "redstone" and events[2] == "top" then
--#Write secondary message
term.setCursorPos(1,1)
--#"\n" is the new line indicator. You can use this to have the terminal automatically start a new line after this indicator.
write("Line 2 Track 2\nTrain has arrived. Please be careful boarding the train")
shell.run("test")
--#I'm not sure what "test" is, but if it's the name of this program you're running,
--#then I'd suggest to not have this line, and instead have your program labelled as "startup"
end
end
This should be a bit better for what you want.