I am asking this question because I accidentally run sudo apt-get purge libre*
and literally everything started deleting to the point where I had to power off to make it stop.
So how does "try Ubuntu without installing" work? Like what is saved, if anything, and does what you do in there affect anything?
"Try Ubuntu without installing" boots Ubuntu as a "live system". That means it runs entirely from the removable media (the installer DVD or USB drive) and not from your internal hard disk.
On a normal Ubuntu DVD or USB installer (without persistence - if you don't know what that is you have not set it up), all changes you make in the live system are only kept in RAM and therefore discarded as soon as you shut it down.
You can however manually mount other storage devices (like the internal hard disk partitions) and modify them. This doesn't happen automatically though, but as @TorstenS pointed out in his comment, it is quite easy to do this accidentally as each mountable partition and device normally gets represented by an icon on the desktop and in the Nautilus file manager. Clicking on that icon will mount the respective file system and show its contents, allowing you to modify everything. You could also still easily format or repartition your disks from a live system, effectively deleting things from your internal disk. Ubuntu won't do anything like that on its own unless you tell it to, but you still have to be careful to not accidentally do that.
About your special case of installing or removing software packages: those changes are also only kept in RAM and are not preserved across reboots (again, unless you manually create an USB installer with persistence, but you most likely didn't do that). The next time you boot from the installer medium, it will be in the exact same state as it was the last time and the times before that.