"you shall not learn to do as the abominations of those nations": I might think that you are forbidden to understand and teach (the falsity of their ways); it is, therefore, written "to do." You may not learn them to do them, but you may learn them to each and to understand.
(דברים יח ט) כִּי אַתָּה בָּא אֶל הָאָרֶץ, עֲשֵׂה מִצְוָה הָאֲמוּרָה בָּעִנְיָן, שֶׁבִּשְׂכָרָהּ תִּכָּנֵס לָאָרֶץ.
(Devarim 18:9) "When you come to the land": Perform the mitzvah stated herein, in whose reward you will enter the land.
אֲשֶׁר ה׳ אֱלֹהֶיךָ נוֹתֵן לָךְ – בִּזְכוּתְךָ.
"that the L-rd your G-d gives to you": in your merit.
לֹא תִלְמַד לַעֲשׂוֹת כְּתוֹעֲבוֹת הַגּוֹיִם הָהֵם – יָכוֹל אִי אַתָּה רַשַּׁי לִלְמוֹד לְהוֹרוֹת וּלְהָבִין? תַּלְמוּד לוֹמַר: לַעֲשׂוֹת – לַעֲשׂוֹת אִי אַתָּה לָמֵד, אֲבָל אַתָּה לָמֵד לְהוֹרוֹת וּלְהָבִין!
"you shall not learn to do as the abominations of those nations": I might think that you are forbidden to understand and teach (the falsity of their ways); it is, therefore, written "to do." You may not learn them to do them, but you may learn them to each and to understand.