Construction of KdV flow I. Tau-Function via Weyl Function