It looks like you are just creating new _detail entities, which, as you already mentioned, are not associated tot the _header. To associate the _detail with the _header, create an "action" button, which triggers a microflow. In this microflow you have the _header as input parameter. Now you could create a new _detail and associate it with the _header. Next, direct the microflow to the _NewEdit page.
Furthermore, it looks like _header is caller of the page and there you have a datagrid of _detail. You should constraint your datagrid to show only the details which belong to this header. Please try it yourself first, otherwise I could help you.
PS. Since the association is 1-1, you could also use a dataview with a microflow datasource to retrieve the _detail entity. A datagrid is used for multiple entities.
Another comment, posted in a separate post because the context is different: what is the purpose of the user entity?
If you want to register which users (with username and password) are doing request, you should make the user entity a specialization of the user entity in the System module.