For a negative purpose, لِكَيْ and لَا are written together: لِكَيْلَا.
لِكَيْ + لَا = لِكَيْلَا
أَدْرُسُ لِكَيْلَا أَرْسُبَ — I study so that I do not fail.
The negative meaning comes from لَا. Preserve the joined spelling when the two are combined.