Hi Josh,
You can't actually write your own affiliate links from scratch even if you understand the basic format because our system will go by the merchant's settings, you cannot impose any settings on the merchant from your end.
The links in your post are only working because this merchant allows you to both link to a landing page for that product or get a direct link to their cart for that product. If you tried that with a different product or for a merchant that you are not an affiliate with the links would not work.
If you would like to link directly to the merchant's cart for a product when they are not offering that option please contact them to ask if they will enable that setting.