How to know "了...就" indicating completed actions
In Chinese language, we don't have the concept of tense. You can find that our verb don't have variation according to different time. We have to use time or other component to indicate whether things are completed or when things are done. For example 我做這件事, 我做完了這件事. We use 了 to indicate that the action is completed. Note that we use the same verb 做 in both of the sentence. In English, you can use did or have done to indicate tense. While It don't happened on Chinese we don't have past tense form of verb 做. So we still use 做 and add other component to indicate time or whether things are completed or not.

If you don't want to indicate time explicitly, you can use 了 to indicate you have completed the action. In this example, you can say 我買了書就回家了. This example exhibit the usage 了. 了 is used indicate 回家 is completed.

完 can be used on this purpose too. You can say 我買完書就回家了.