It was probably an indirect flight to Yemen with a stop somewhere else in route.
He was either testing security or he was going to plant the knife for a fellow terrorist who would board the plane at the connecting airport.