Devarim11:22

כִּי אִם־שָׁמֹר תִּשְׁמְרוּן אֶת־כָּל־הַמִּצְוָה הַזֹּאת אֲשֶׁר אָנֹכִי מְצַוֶּה אֶתְכֶם לַעֲשֹׂתָהּ לְאַהֲבָה אֶת־יְהוָה אֱלֹהֵיכֶם לָלֶכֶת בְּכָל־דְּרָכָיו וּלְדָבְקָה־בוֹ׃

For if you diligently keep all this commandment which I command you to do, to love the Eternal your Almighty, to walk in all His ways, and to cleave to Him,

Devarim 11:22

כִּי אִם־שָׁמֹר תִּשְׁמְרוּן

Devarim / Deuteronomy 11:22 · Remez

Devarim 11:22

כִּי אִם־שָׁמֹר תִּשְׁמְרוּן אֶת־כָּל־הַמִּצְוָה הַזֹּאת אֲשֶׁר אָנֹכִי מְצַוֶּה אֶתְכֶם לַעֲשֹׂתָהּ לְאַהֲבָה אֶת־יְהוָה אֱלֹהֵיכֶם לָלֶכֶת בְּכָל־דְּרָכָיו וּלְדָבְקָה־בוֹ׃

For if you diligently keep all this commandment which I command you to do, to love the Eternal your Almighty, to walk in all His ways, and to cleave to Him,

Remez רֶמֶז

Keeping and being kept

In Hebrew the same letters can be read in different ways, and the meaning changes. The midrash hears a promise in the word "keep".

Rashi: the doubled verb "keeping, you shall keep" warns of much keeping: guard your learning so that it is not forgotten. Rabbeinu Bahya brings a midrash: the same letters read "you will be kept". One who keeps the commandments of the Torah is kept from every enemy. So too in the passage "And it shall be, if you listen": one who listens to the Torah will be listened to.

How Rashi and Rabbeinu Bahya explain it

Rashi Keeping, you shall keep (שָׁמֹר תִּשְׁמְרוּן)

A warning of many kinds of keeping: to guard one's learning so that it is not forgotten.

Rabbeinu Bahya If you diligently keep

And in the midrash: "if keeping (שָׁמֹר)" the commandments of the Torah, then "you will be kept" (תִּשָּׁמְרוּן) from every enemy and every harm. So too the passage above begins: "And it shall be, if you listen (שָׁמֹעַ תִּשְׁמְעוּ)", that is, if you listen to the words of the Torah, then "you will be listened to" (תִּשָּׁמְעוּ). And from the yes you hear the no, as it is written: "Whoever stops his ears at the cry of the poor, he too will call and not be answered" (Mishlei / Proverbs 21:13).

Takeaway

The verb here appears twice, as in verse 11:13: שָׁמֹעַ תִּשְׁמְעוּ ("listening, you will listen") and שָׁמֹר תִּשְׁמְרוּן ("keeping, you will keep") (Devarim / Deuteronomy 11:13, 11:22). Rashi sees in the repetition many kinds of keeping.
The warning not to forget is also at the start of the book: "Only take care, and guard your soul diligently, lest you forget the things your eyes have seen" (Devarim / Deuteronomy 4:9).