No, that is forbidden due to writing.
If so, it must also be forbidden to cut into a cake that has letters or a picture on it.
That is not completely correct. Although it is true that it’s preferable to cut between the letters in such an instance so as not come under any question of erasing. If it is unavoidable, some poskim say that you may cut through the letters, especially if that which was written would have dissolved on its own in any case. Ask your Rav if you may be lenient in this.
There are foods that have words inscribed on them by the manufacturer, like crackers or biscuits. Is it a problem to break them in half if I will be destroying the word in the process?
There is no problem doing this. The writing must be a separate entity. Here the cracker itself has the writing on it.
I just went to a Kiddush and they had adorable cookies in the shape of a bassinet with the words Mazel Tov written on top of them with frosting. There were also delicious looking cupcakes which also had writing on them. Was I right not to eat them because it would be erasing?
It is permitted to eat anything in which the erasing is happening while you are eating.
May I slice a cake if it has writing on it?
Sure. You can either take off the words (if possible), or you can cut between the letters. As long as you try to be careful, even if you do accidentally cut a little bit of one of the letters, it is absolutely fine.
The Melachos of Writing/Erasing.
In this issue, we introduce two interconnected melachos; Koseiv and Mocheik (Writing/Erasing).
The melacha of koseiv is defined as making any type of mark or image that has significance. It makes no difference what you write with, how you write it, or what you write it on; creating any meaningful symbol falls under the category of koseiv.
For example, it is very common for people passing by a dusty car to write “clean me” out of the dust. That would be a problem on Shabbos. So would doing a puzzle on Shabbos; it creates a picture and is therefore forbidden because of the melacha of writing. Koseiv can even be accomplished by erasing; if you would erase something to create something new out of what was erased, like erasing part of a w to create a v. Koseiv has many implications. We will go through some examples.
The rule of thumb is that anything that would have been a problem to create due to koseiv, is forbidden to erase because of mocheik. Meaning, just like you need to make a significant word or image to transgress the melacah of writing on Shabbos, you need to erase a significant word or image to transgress the melacha of erasing. (With a few exceptions…of course)