All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Firstly, you should know that the Companions wrote the Quran without dots or diacritical marks, like the early Arabs used to do, relying on their strong command of the Arabic language. The dots and diacritical marks were added later on in order to facilitate the recitation and understanding of the Quran given the wide spread of recitation errors that were made by the many non-Arab converts to Islam.
Abu ‘Amr Ad-Daani wrote, “It was narrated from Yahya ibn Abi Katheer that he said, ‘The early script of the Quran was without dots or marks. Then the first thing that was introduced to it was the two dots under the letter (yaa') and the two dots over the letter (taa'). The scholars approved it, considering it a means for facilitating the correct recitation of the Quran...’” [Al-Muhkam fi Naqt Al-Masaahif]
As for the question about the two letters (yaa') in the word يستحيى; the first is dotted, and there is no difference of opinion in this regard. The second comes at the end of the word and it is written without dots according to the view of the majority of scholars. Some held that it may be dotted as well.
Abu ‘Amr Ad-Daani wrote, “The letter (yaa') is dotted when it is attached in order not to be confused with what comes before it. If it is detached, it is not dotted.” [Al-Muhkam fi Naqt Al-Masaahif]
Daleel Al-Hayraan ‘ala Mawrid Ath-Tham'aan, p. 435 reads:
“The (yaa') ي at the end of the word may be dotted or undotted, and the same applies to the (noon) ن, (faa')ف, and (qaaf) ق at the end of the word. They are grouped in the word ينفق. Ad-Daani said in his book Al-Muhkam that these four letters are undotted only when they come at the end of the word. This is because when they come at the end of the word, the potential confusion between them and the letters written in similar shapes is eliminated. However, when they come at the beginning or middle of the word, they all must be dotted.”
Shaykh Adh-Dhabbaa' held that the (yaa') at the end of the words in the Quran is undotted in all cases. He wrote, “Note: The (yaa') is undotted in the Quran if it is under a Hamzah ىء (as in بَرِىء) or at the end of the word whether it is Mawqoosah ي (as in ّقَوِى) or Ma'aqoosah ﮮ (as in إِﮮلافِهِم) or substituting an Alif ى (as in تَتَمَارَى)" [Sameer At-Taalibeen]
The resolution of the Academy of the Arabic Language in its session held in Cairo in 1980 reads, “The soft alif (alif layyinah) at the end of the word is written in the form of an undotted (yaa') ى; whereas the (yaa’) is dotted ي to distinguish it from the soft alif ى.”
Accordingly, it is allowed to dot the (yaa’) at the end of the word, and it is also allowed to leave it undotted regardless of whether it is a verse of the Quran or any other text; there is no harm in that.
Allah knows best.