if I turn off the computer immediately after I edit and save a file, my changes will be most likely lost?
They might be. I wouldn't say "most likely", but the likelihood depends on a lot of things.
An easy way to increase performance of file writes, is for the OS to just cache the data, tell (lie to) the application the write went through, and then actually do the write later. This is especially useful if there's other disk activity going on at the same time: the OS can prioritize reads and do the writes later. It can also remove the need for an actual write completely, e.g. in case of a temporary file that is removed quickly afterwards.
The caching issue is more pronounced if the storage is slow. Copying files from a fast SSD to a slow USB stick will probably involve a lot of write caching, since the USB stick just can't keep up. But your cp command returns faster, so you can carry on working, possibly even editing the files that were just copied.
Of course caching like that has the downside you note, some data might be lost before it's actually saved. The user will be miffed if their editor told them the write was successful, but the file wasn't actually on the disk. Which is why there's the fsync() system call, which is supposed to return only after the file has actually hit the disk. Your editor can use that to make sure the data is fine before reporting to the user that the write succeeded.
I said, "is supposed to", since the drive itself might make the same lies to the OS, and tell that the write is complete, while it's really only in a volatile write cache within the drive. Depending on the drive, there might be no way around that.
Then there have been some cases where just running fsync() on the file you were processing wasn't enough to make sure the file was accessible later, but instead the application had to know enough of the filesystem internals to do more than that.
There's also the O_DIRECT flag to open(), which is supposed to "try to minimize cache effects of the I/O to and from this file." Removing caching reduces performance, so that's mostly used by applications (databases) that do their own caching and want to be in control of it.
(O_DIRECT isn't without its issues, the comments about it in the man page are somewhat amusing.)
In practice, on a lightly loaded system, the file will hit the disk within a moment. If you're dealing with removable storage, unmount the filesystem before pulling the media to make sure the data is actually sent to the drive, and there's no further activity. (Or have your GUI environment do that for you.)