First off, there will be no penalty for a cash withdrawal if you retire at age 57 with 37 years of service. As long as you separate in the year you turn 55 (or later) there is no early withdrawal penalty.
And, yes you can do a rollover and take cash in a partial withdrawal from the TSP. You list the total amount of your withdrawal in box 11 and then indicate that you want to transfer “all or part” of your withdrawal in box 12.
Then you list the percentage of the withdrawal from your traditional TSP that you want to be transferred (rolled over) to a traditional IRA in box 33. After that, a representative of the firm to which you are transferring the money needs to complete the boxes in section X. If you are transferring your Roth balance it’s box 41 and section XII.