Hi @Mhmdbaba ,
From the code, I see that you have a dataset PCF, but you actually don't use the data provided by the dataset.
Basically you make a webAPI request by yourself to get the records. That way it's hard to interact with the CustomPage.
You could declare another output property in your manifest, and pass that value in yout getOutputs() method, containing the selcted id. Then you can access that output property fromn your Button. But I wouldn't recommend it.
A better approach would be to let the platform work for you.
1. make use of the dataset property you've declared inside your manifest. This will contain the data provided by your CustomPage. The definition of the data will be made using PowerFx (get a dataSource in your CustomPage and filter the data as needed using PowerFx)
2. inside your component you can use the dataset.records provided, to show the data.
3. The dataset has a method to set the selectedRecordIds: https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/dataset?WT.mc_id=BA-MVP-5004107#methods. If you set that inside your PCF, you are able to access the selectedRecord outside the PCF (in your CustomPage)
4. In the CustomPage, define the OnSelect function for your button. Set oit as <YourPCF>.Selected like in the screenshot below (of course, through the ".Selected " you have access to the fields inside the collection).

Actually there is a FluentUI dataset PCF, ready to use, made by the Microsoft Power CAT team. You can find it in the Creator Kit: https://powerapps.microsoft.com/en-us/blog/introducing-the-creator-kit-efficiently-create-performant-fluent-ui-based-power-apps/. There are 3 solutions: one with the PCFs (not only the FluentUI DetailsList, but a lot of others), and demo solutions (one of them fpr CustomPages - in the MDA solution).
PS: By the way, using the Xrm object inside the PCF is not supported. If you need webAPI Requests, you must declare the usage inside the manifest, and get yout webAPI object through context.webAPI: https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/context?WT.mc_id=BA-MVP-5004107#webapi
Hope this helps 🙂