You can receive the ID as number in your flow trigger, So you can place that ID directly in Add attachment action, No need to initialize variable.
Then, for the Signature Image, If you have already done converting it into Base64 in Power Apps. You can send it to Power Automate as text.
In short, Your flow should remain almost the same except using ID instead of TicketNumber for an Id for Add attachment.
OR You can follow my try:
First, your flow will accept 2 input
- Signature (as File)
- ID (as Number)
Next, follow this picture

Finally, the Flow run code (In Power Apps)
Flow.Run(
{
contentBytes: PenInput1.Image,
name: "Signature_" & varRecord.TicketNumber & ".jpg"
},
varRecord.ID
)