The main purpose of this legislation is to protect student privacy in educational settings by preventing federal education funds from being allocated to any school or educational institution that shares student records or information for immigration enforcement purposes. The goal is to create a safe environment for students, particularly those from immigrant backgrounds, ensuring they can access education without fear of their information being used against them in immigration matters.