Does the order of amino acids matter in making up a protein?
Yes.

The 'order' of amino acids is the protein sequence, also known as the primary structure. A peptide (short protein) with sequence XYXYXYXYX is very different from XXXXXXXYYYYYYY.

Your example is a bit trickier, since it seems like AB should be roughly equal to BA. However, each amino acid has two ends - the amino and carboxyl - and so a dipeptide like this is more like NH2-A-CONH-B-COOH with a peptide bond in between.

The really tricky question is : are two sequences 'the same' if they are different by just one or two letters. In other words is AAAAAABAAAAAA different from AAAAAACAAAAAA - and this is the study of mutations of proteins.

There is a lot more to say on this topic, of course.