If the power jack has come loose, you need a soldering iron to reattach it to the motherboard. It needs to be a good one, the cheap ones don’t get a good enough temperature to get rid of the old solder. If the power jack itself is damaged, you can usually buy a replacement power jack online with the correct make and model number of the laptop.
If you’re not that good with a soldering iron, or don’t have one, then you can disassemble the laptop and take the motherboard and power jack to a computer repair shop and they should be able to do it. Most of the time is taken up by the disassembly as it can be a bit persnickety, but instructions are available online and on YouYube for many different models.