This is why I pointed you to the address input documentation. I know you are NOT using an address input but getting that data from elsewhere, but what I suggested was to see the format that the Address Input uses and try to parse your text into the same format before entering it into your CMS.
Which is why it is always recommended to search on the forum first for similar questions before posting your own. Chances are somebody has already faced the same issue before you and has found a working solution to it. All you need to do is to research thoroughly first.
The solution above seems to format the object into a valid address using an external API. If straightforward text-to-object parsing isn’t working, then you can take some inspiration from this one and customize it to fit your needs.