The Shulhan Aruch rules (Siman 32; listen to audio recording for precise citation) that the four Parashiyot placed in the Tefillin must be written in the sequence in which they appear in the Torah. This means that when the Sofer writes the parchment that will be placed inside the Tefillin, he must first write the section of "Kadesh Li," followed by "Ve’haya Ki Yebi’acha," then "Shema Yisrael" and finally, "Ve’haya Im Shamo’a." The Shulhan Aruch writes explicitly that if the Parashiyot were written out of order, the Tefillin are invalid for use. For example, if the Sofer first writes the Parasha of "Shema Yisrael" and then "Kadesh Li," the section of "Shema Yisrael" was written out of sequence and thus cannot be included in the Tefillin.
This is one reason why the most important qualification for a Sofer is Yir’at Shamayim – fear of G-d. A person can bring his Tefillin to a Rabbi to be examined, and there are numerous potential defects which the Rabbi will be able to find, but nobody will ever know in which sequence the Sofer wrote the four Parashiyot of the Tefillin. It is only genuine fear of G-d that would lead a Sofer to be honest and ensure that the Tefillin are written in the proper sequence. Once money is involved, and Tefillin becomes a business of sorts, there is temptation to compromise one’s integrity for the sake of profit. It is only sincere Yir’at Shamayim that will force a Sofer to conduct his operation with perfect honesty. And therefore, as important as it is for a Sofer to have good penmanship, it is even more important that he has genuine Yir’at Shamayim, and this must be the first quality we look for when choosing from whom to purchase Tefillin.
Summary: The Parashiyot of the Tefillin must be written in the sequence in which they appear in the Torah. Since there is no way of verifying this after the Tefillin are written, it is imperative to purchase Tefillin only from a Sofer who is known to be honest and G-d-fearing.