The gemara says that one cannot be mekadesh a woman with a loan that he previously lent her, but can be mekadesh her with a loan that someone owes him, by transferring the loan to her (so that she is now owed the money). The Rishonim have different approaches to explain the difference between being mekadesh her with a loan to her and a loan to someone else:
1. Tosafos (d.h. l'olam) - The reason one cannot be mekadesh a woman with a loan that he previously lent her, is because he is not giving her anything write now. Since at the time he lent her the money it was meant to be spent, and is no longer in existence at the time of kiddushin (even if it is, it is as if it isn't), he is not giving her anything now because that money is already hers (just that she owes the same amount back). But, when he is mekadesh her with a debt that someone else owes him, he is giving her something now i.e. the contract, and therefore she is mikudeshes with the money that was owed to him.
2. Ran - Basically the Ran agrees with Tosafos as to why he can't be mekadesh her with money that he previously lent her. However, when he uses a loan that is owed by someone else, he is not being mekadesh her with kesef, since the money is not here. Rather, he is being mekadesh her with the benefit she receives by now having the ablilty to collect a debt from someone else, which is a definitive benefit that he is providing her with. This approach is based on the assumption that although one cannot be mekadesh a woman with the actual money of the loan that she owes him, he can be mekadesh her with the benefit that she receives from him being mochel the loan. Therefore, he can be mekadesh her with a debt that someone else owes him, since that is no worse that being mekadesh her with some benefit.
3. Aveni Miluim (28:31) - The reason that one cannot be mekadesh a woman with money she owes him is not because it is already hers. Rather the reason is because it is a davar sh'elo ba'ah l'olam. Meaning, he doesn't have control over the money to be able to be makneh it to someone else. Although he is able to be mochel it to her, since he has no ability to be makneh it to someone else, it is not considered to be money coming from him. Therefore, when he is makneh to her a loan that someone else owes him and does it with kesivah u'mesirah to make a real kinyan, it is a davar sheb'ah l'olam that is why it works. Based on this the avenei miluim says that if she owes him money and he takes the shtar chov that says she owes him and is makneh it to her with kesuva u'mesira, as he would do with a shtar chov of someone else, she would be mikudeshes.