There are several ways to achieve this. Personally, I would add the AP config file to the image.
When you perform your nmcli command, a persistent conf file is created in /etc/NetworkManager/system-connections/apname.
You can then the copy it to your yocto build tree, and add a networkmanager.bbapend in which you add this config file to the image.
Note that your password will be clearly visible.