Welcome to Microsoft Q&A!
But my issue is when I restart the PC the widget do not stay pinned i.e.
I'm afraid you can't do that, It's managed by system level, And there is no such api could make widget on the top all the time even restart pc. if you do want this feature please feel free post your requirement with windows feed back hub app.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.