The ていく and てくる forms can express many different things. If you can imagine a timeline from past -> present -> future, てくる (てきた can be considered present perfect tense) will usually describe actions that have occurred prior to the present moment, whereas ていく will describe actions that will occur moving forward.
Also, whether you use ていく or てくる will depend on whether the thing/person that is moving is approaching or leaving the speaker.
Another concept that is expressed by てくる・ていく, is to, according to my grammar dictionary, "Do something and then move on." Without knowing the larger context around the sentence you provided, it's hard to say for sure, but ワインを買っていく could imply that the speaker is going to buy wine, and then go somewhere else or do something else. Whereas if they said ワインを買ってくる, it would mean that they were going out to buy wine and then return.