Hi @flyingspoon
Okay so to get the File ID. Use:
'Get files (properties only)' On your Library. Than use:
'Filter array' action to filter the name of the file. (Filter array has to be used since SharePoint uses a calculated formula to get the name of the file. So we cannot use the regular filter query inside the SharePoint Get files action).
Select the Name dynamic content on the right side of the Filter array. and on the right side put the name of the file without extension. You can use any filter query you like. I am using name just as an example.

Now inside the Check out and Check in actions we have to use an expression on the ID so we don't get put into the Apply to each loop.
My Filter array action is named 'Filter array' so my expression will be:
first(body('Filter_array'))?['ID']
This expression will be used on both the Check out action, and the Check in action:

NOTE:
To see what can used for filter. Run the Flow and copy the Get Files output to notepad or some code editor to easily be read.
You mentioned you already had the Link to the file. So you could even use the Filter array action and filter on the Link
