First of all, congratulations on going on a diet and already losing 20 kilos of weight! Working hard to get down to a healthier weight is a good way to help guarantee your good health going forward. I would strongly recommend that you discuss this issue right away with your primary care doctor
The symptoms that you are describing are concerning and, while there are several potential causes for what you are experiencing, I do think that the most likely explanation has to do with your weight. What might be happening is that, when you lie flat, the weight of your abdomen presses upwards against your diaphragm, which makes it difficult for your lungs to expand and, therefore, for oxygen and carbon dioxide gases to move in and out normally. This will lead to the feeling of weakness and shortness of breath that improves when you move into a position that relieves the pressure on your diaphragm.
Again, I would strongly recommend that you discuss this issue right away with your primary care doctor, or which ever other doctor is helping you with your weight loss
plan, as these symptoms might also be occurring at other times when you are not aware of them, such as when you are asleep, and this could be quite dangerous for your health.