If the charging cable is loose (it wiggles around) when plugged in, there is likely damage to the charging port of the phone.
Depending on the way it was built the charging port (inside the phone) will be on a cable or soldered to the main motherboard. Judging by your model and some search results, yours is soldered on to the board. I would call around to local shops (with good online reputation) and see if anyone there offers soldering replacements for charging ports. It shouldn't cost more than $70. $50-60 is the normal range.