In Exodus / Shemot 32:32, we read : “And now, if You forgive their sin But if not, erase me now from Your Scroll, which You have written” ( וְעַתָּ֖ה אִם־תִּשָּׂ֣א חַטָּאתָ֑ם וְאִם־אַ֕יִן מְחֵ֣נִי נָ֔א מִסִּפְרְךָ֖ אֲשֶׁ֥ר כָּתָֽבְתָּ ). Moshe משֶׁ֑ה is demonstrating both compassion for Yisrael and more importantly יִרְאַ֣ת יְ֖הוָה Fear of YHVH.
Moshe משֶׁ֑ה does not refer simply to his name being removed from HaTorah but instead references God’s Sefer Zikaron סֵ֣פֶר זִכָּר֚וֹן (Scroll of Remembrance) used to acknowledge a soul’s life. Sefer Zikaron maintains a soul’s life if the soul demonstrates Fear of YHVH as described later in מַלְאָכִֽי Malaki 3:16:
“Then the God-fearing men spoke to one another, and YHVH hearkened and heard it. And a Scroll of Remembrance was written before Him for those who feared YHVH and for those who valued His Name highly.” ( אָ֧ז נִדְבְּר֛וּ יִרְאֵ֥י יְהֹוָ֖ה אִ֣ישׁ אֶל־רֵעֵ֑הוּ וַיַּקְשֵׁ֚ב יְהֹוָה֙ וַיִּשְׁמָ֔ע וַ֠יִּכָּתֵב סֵ֣פֶר זִכָּר֚וֹן לְפָנָיו֙ לְיִרְאֵ֣י יְהֹוָ֔ה וּלְחֹֽשְׁבֵ֖י שְׁמֽוֹ )
In recognition of Moshe’s reverent Fear, God acknowledges the compassionate heroism of משֶׁ֑ה Moshe stating in Exodus / Shemot 32:33: "Whoever has sinned against Me, him I will erase from My Scroll!" ( מִ֚י אֲשֶׁ֣ר חָֽטָא־לִ֔י אֶמְחֶ֖נּוּ מִסִּפְרִֽי )