to know if it’s a new post, you juste need to read the value of $postarr["ID"]
:
$postType = "post";
add_filter("wp_insert_post_data" . $postType, function ($data, $postarr) {
if (0 === $postarr["ID"]) { // it's a new post
$data["post_author"] = 45;
}
return $data;
}, 10, 2);