The reaction between formaldehyde and ammonia is written as follows
HCHO + NH3 ---------> H2C=NH + H2O
This is a condensation reaction in which two molecules or functional group combine to form a single molecule with the loss of water. As a water molecule is being lost, hence it more specifically a dehydration reaction. Here the product that is being formed is an imine.