to know that you first have to understand the transaction structure and learn what each part means. for example the scripts https://en.bitcoin.it/wiki/Script
so to answer your question directly, you should create a new txout and set its scriptpub to a new script that corresponds to your address. in pseudo code:
addresstype = GetType($address)
if (addresstype == base58_p2pkh)
scriptpub = OP_DUP OP_HASH160 Push(ConvertAddrToHash($address)) OP_EQUALVERIFY OP_CHECKSIG
else if (addresstype == base58_p2sh)
scriptpub = OP_HASH160 Push(ConvertAddrToHash($address)) OP_EQUAL
else if (addresstype == bech32_p2wpkh)
scriptpub = OP_0 Push(ConvertAddrToHash($address))
....