All methodologies have the goal of working software. Where they differ is in how they try to get there.
Agile came about because people started saying "hey, this process we have for creating working software isn't actually creating working software. Maybe we should try another process."
Software is a hell of a lot easier to write and test if you have a decent well thought out set or requirements. Getting that is far harder than any coding.