"Until the sun sets you shall restore it to him" — this is the nighttime garment, which is given to be taken as a pledge by day. "You shall surely restore to him the pledge when the sun goes down" (Deuteronomy 24:13) — this is the daytime garment, which is given to be taken as a pledge by night. It was taught: Rabbi says: Since one must return it, why take it as a pledge at all from the start? So that the Sabbatical year should not come and cancel the debt, and so that if he dies it should not become movable property in the hands of his children [beyond the creditor's reach].
Why Take a Pledge You Must Keep Returning Day and Night
Yalkut Shimoni on Torah 351:2
עַד בֹּא הַשֶּׁמֶשׁ תְּשִׁיבֶנּוּ לוֹ, זוֹ כְּסוּת לַיְלָה, שֶׁנִּתַּן לֵיִחָבֵל בַּיּוֹם. "הָשֵׁב תָּשִׁיב לוֹ אֶת הָעֲבוֹט כְּבוֹא הַשֶּׁמֶשׁ", זֶה כְּסוּת יוֹם, שֶׁנִּתַּן לְיִחָבֵל בַּלָּיְלָה. תַּנְיָא, רַבִּי אוֹמֵר, וְכִי מֵאַחַר שֶׁמַּחֲזִירִין, לָמָּה מְמַשְׁכְּנִין מֵעִיקָרָא, שֶׁלֹּא תָּבֹא שְׁבִיעִית וּתְשַׁמַּטְּתוֹ, וְאִם מֵת לֹא נַעֲשֶׂה מִטַּלְטְלִין לְבָנָיו.