The second phrase, "who walk in the law of the LORD," defines what is meant by the first phrase, "undefiled in the way." To be undefiled in the way is to walk in the law of the Lord. If we understand that Old Testament laws have application under the New Covenant, then we should also understand that Psalm 119:1 was written for us. The way we can be undefiled in the way is to walk in the law of the Lord.
Walking is an action. It requires effort to get somewhere. It is doing something. There is a teaching out there that proclaims: "One cannot overcome spiritual sin by doing physical things." Yet, this is satanically deceptive because it clouds the clear picture of what God requires. God's laws have a physical application, and they are to be used, to be kept, to be observed in our life experiences - interacting with other people and the rest of God's creation. We have to observe or keep them, we have to "walk" in them, to become sanctified. Put another way, the character God is creating in us does not become ours unless His way is put into practice.
Character can be defined as a set of highly developed traits that are so much a part of our personality that we act according to them without even thinking. Character can be good or bad. What God wants is His character - holy, righteous character. Good character can be defined as highly developed skill in living. Like any other skill, it does not become really useful without practicing it. Skill or expertise does not happen magically. It is the combination of natural ability and education, training, and discipline.
For example, when I sit down at the keyboard in front of my computer, I do not have to think about where each letter is on the keyboard. Why? That information is now written within me, not necessarily because I memorized it but because I put it into practice over many years of typing. That knowledge is now a part of me, and I will never forget it. We can apply this same principle in regard to God and what He has us do. We must do God's Word, or it will never become a part of us.