How can I add a custom field to an existing custom post type?

If you want the custom fields to appear on the custom post type edit page, you can add meta boxes for your particular custom post type. Check this for a detailed example. Also, if you’re adding/updating custom fields conditionally, use add_post_meta or update_post_meta. All of this code can go in your functions.php file.