There are a few things that can cause this to happen. One could be that you cut into the cake while it was still too hot. Another could be that you used the wrong type of apple and it didn’t stand up to baking. One last possibility could be that the recipe provided too much moisture and the apple cake couldn't hold it’s structure.