Do you know where the Category Builder Icon is in the icon list above the Biography area? It looks like some steps, just before the 'C'.
Selecting that I entered War of 1812 Canada, it showed lots of 1st regiment, scrolling down I found Lincoln, so selecting that will put the Category entry into the profile. Using that information as the Unit name in the template because that will generate the category automatically and you don't need to include the category in your profile, add the rank=Captain, branch=Canada (the explanation says service branch or country)