A couple of times, St. Thomas makes use of the following analogy from Aristotle:
Understanding is to Willing as A Principle is to the End as A Conclusion is to the Means
In other words, the means are like the conclusion of an argument, given that you want to obtain the end:
I want a donut. ["a donut" = the end]
If I buy a donut, I will have a donut.
Therefore, I want to buy a donut. ["to buy a donut" = the means]
This is another way of showing how the means follows [logically] from the end, although we often think of the end as following [chronologically] the means. We may obtain the end after we obtain the means, but we will the means after we will the end.