Can we use $y * \operatorname{sgn}(\hat y)$ as a loss function in linear regression? Can we use $y * \operatorname{sgn}(\hat y)$ as a loss function in linear regression where $\hat y$ is the prediction and $y$ is the target value, or is there any other loss function close to this which can be used?

For a loss function to work effectively, its smallest values should occur where $y \approx x.$
Such small values are shown in dark blues in this filled contour plot of the standard quadratic loss function $\mathcal{L}(x,y) = (y-x)^2.$

Visually, you want the colors surrounding the diagonal line $y=x$ to be dark blue.
Here is a comparable plot of $\mathcal{L}(x,y) = y\operatorname{sgn}(x):$

The dark blues occur where $x$ and $y$ are large and of opposite signs.  This will not be an effective loss function unless you want your predictions to be as far away from the true values as you can possibly make them!

I hope it's now clear that any function that comes even close to this one will not be a useful loss function.  But at least you now have a rapid, reliable visual procedure to evaluate any candidate loss function you might care to think up.  To make this as easy as possible to do, here is R code to produce a plot of a loss function.
#
# Create an array of losses.
#
loss <- function(x, y) y * sign(x)
y <- x <- seq(-1, 1, length.out=201)
z <- outer(x, y, loss)
#
# Plot its values and the reference line y == x.
#
col <- rev(rainbow(13, 2/3, 1)[1:10]) # The color scale red ... blue
image(x, y, z, col=col, main=bquote(paste("Contours of ", .(body(loss)))))
contour(x, y, z, add=TRUE)
abline(0:1, lwd=2, col=gray(.25))

