Causal Inference with Mendelian Randomization for Longitudinal Data