The swimming behaviour described is termed glass surfing, and in loaches it is a sign of quite severe stress. This is two-edged. Normally it will occur when the fish are moved to a new environment, like acquiring them. This is to be expected, because the species we term loaches do not like changes in their environment. However, there is another much more serious issue here, and that is the numbers as
@Slaphppy7 mentioned. Loaches are highly social fish, and they absolutely must be in a decent-sized group. They will develop an hierarchy fairly quickly, with an alpha fish (often if not always a female) and they will govern themselves accordingly. But two fish cannot possibly do this, and that is where the severe stress comes in. The fish have this need programmed into their genetic blueprint, and we cannot change that.
No mention is made of the tank size, nor the species (common names are not reliable, I could find several very different species of loach that might be called "striped"). The algae eater again being a common name does not tell us which species of fish, and there are several to which this name is correctly or incorrectly applied. Unfortunately some of these are downright nasty and not at all possible with loaches. Please let us have this information, as these issues will only worsen with time.