how to revert changes on /etc/environment, which prevent a login

Restart your system, when starting press ESC to reach the grub bootmenu.

Start the recovery mode, open a root shell and revert the changes.