Try commas at the end of each line:
SELECT DISTINCT Aircraft.Registration AS "Reg",Flights.Callsign AS "Flight ID",Flights.Route AS "Route",Aircraft.AircraftTypeSmall AS "ICAO Type",Aircraft.Airline AS "Airline",Aircraft.AircraftTypeLong AS "Aircraft",substr(Flights.EndTime,1,16) AS "Flight Ended",Flights.StartAltitude AS "Start Alt",Flights.EndAltitude AS "End Alt",Flights.MsgCount AS "Count",Aircraft.ModeS AS "Mode S" FROM Aircraft LEFT OUTER JOIN Flights ON (Aircraft.ModeS=Flights.ModeS) WHERE ((date('now','-1 day') = substr(Aircraft.LastTime,1,4)||"-"||substr(Aircraft.LastTime,6,2)||"-"||substr(Aircraft.LastTime,9,2)) AND (Flights.StartTime IS NULL)) OR ((date('now','-1 day') = substr(Flights.EndTime,1,4)||"-"||substr(Flights.EndTime,6,2)||"-"||substr(Flights.EndTime,9,2))) OR ((date('now','-1 day') = substr(Flights.StartTime,1,4)||"-"||substr(Flights.StartTime,6,2)||"-"||substr(Flights.StartTime,9,2))) ORDER BY Aircraft.Registration,Flights.EndTime,Aircraft.ModeS;