You need to understand what the MEL commands are actually doing. It's referencing specific vertices/faces etc. Obviously with different points, you will need to use a different command, so what you're doing won't work. You would need to figure out how to traverse the topology, which isn't worth the time. MEL can't save you from everything
Imagination is more important than knowledge.