In speech, the intonation would usually give the meaning.
"Don't drink and drive" is unambiguous to a native speaker. It means "Don't drive after you've been drinking alcohol"
So, it means: Don't [A and B].
Your sentence means: Don't A and Do B.
Another meaning is: Don't A and Don't B, as in "Don't do drugs and engage in antisocial behaviour."
Don't A and Don't B = Don't [A or B].
When this construction is used, you can usually tell its meaning from the context. Naturally, it's often used ambiguously.
PS: The best fix for your sentence is: "Walk in line and don't run."
Student or Learner