Estimation and Inference for Causal Functions with Multiway Clustered Data