Teresa,
First, yes, you can buy the tickets in Vernazza. A good part of your trip will be on the intercity and regionale trains, which you buy as you need them, so you may as well buy the freccia (high speed) ticket all at the same time, at least a day or so before. The ticket station in Vernazza is very helpful to make sure you get on all the right trains. My very first time there I just went to them, said I need to get from point A to point B, and they gave me the easiest way.
As far as connections, that is up to you how many times you change trains. I prefer less changes, even if it takes a little longer. I don't mind the train ride, and it is one less time I have to get off and find another train.
On Trenitalia, the choices I saw (looking briefly) were-
Vernazza - Milano Centrale - Venezia S. Lucia (2 changes, 6hr 38 min)
Vernazza - La Spezia-Parma - Bologna Centrale - Venezia S. Lucia (3 changes, 6hr 20min)
Vernazza - Pisa Centrale - Firenze S.M.Novella - Venezia S. Lucia (3 changes, 4hr 52min)
Important things to remember are to use the Italian name of the city/station you are going to, not the
English! Validate all local train tickets! If you don't, and are caught, you will incur a huge fine, collected on the spot! Freccia seats are reserved, do not sit in someone elses!!